|
|
|
@ -183,13 +183,17 @@ static size_t dirlist_read(struct sxstream_opened *stream, size_t sz, uint64_t o
|
|
|
|
|
list_head_t *llist_prev = sxstream_opened_getelist(stream);
|
|
|
|
|
list_head_t *llist_new = NULL;
|
|
|
|
|
|
|
|
|
|
if(!pslist || !llist_new) return -1;
|
|
|
|
|
if(!pslist) return -1;
|
|
|
|
|
|
|
|
|
|
/* read and fill new list */
|
|
|
|
|
if(readdir_r(pslist->dp, &(pslist->dent), &(pslist->dres)))
|
|
|
|
|
return -1;
|
|
|
|
|
if(readdir_r(pslist->dp, &(pslist->dent), &(pslist->dres))) return -1;
|
|
|
|
|
|
|
|
|
|
/* if finished return 0 */
|
|
|
|
|
if(!pslist->dres) return 0;
|
|
|
|
|
if(!pslist->dres) {
|
|
|
|
|
if(llist_prev) sxstream_generic_slist_free(llist_prev);
|
|
|
|
|
stream->ent_buf = NULL;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/* allocate a new */
|
|
|
|
|
if(!(llist_new = sxstream_generic_slist_alloc())) return -1;
|
|
|
|
|
else { /* fill this list */
|
|
|
|
@ -202,7 +206,7 @@ static size_t dirlist_read(struct sxstream_opened *stream, size_t sz, uint64_t o
|
|
|
|
|
goto __fail;
|
|
|
|
|
}
|
|
|
|
|
/* otherwise destroy last list */
|
|
|
|
|
sxstream_generic_slist_free(llist_prev);
|
|
|
|
|
if(llist_prev) sxstream_generic_slist_free(llist_prev);
|
|
|
|
|
*rlist = llist_new; /* assign new list */
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|