fixed an error checking when extending a file list in lowntfs-3g

PERMISSION_HANDLING_BRANCH
Jean-Pierre André 2010-04-19 11:04:13 +02:00
parent 3e4826f758
commit fcb114502d
1 changed files with 21 additions and 10 deletions

View File

@ -1033,21 +1033,32 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx,
newone = (ntfs_fuse_fill_item_t*)ntfs_malloc
(sizeof(ntfs_fuse_fill_item_t)
+ current->bufsize);
newone->off = 0;
newone->bufsize = current->bufsize;
newone->next = (ntfs_fuse_fill_item_t*)NULL;
current->next = newone;
fill_ctx->last = newone;
current = newone;
sz = fuse_add_direntry(fill_ctx->req, current->buf,
current->bufsize - current->off,
filename, &st, current->off);
if (newone) {
newone->off = 0;
newone->bufsize = current->bufsize;
newone->next = (ntfs_fuse_fill_item_t*)NULL;
current->next = newone;
fill_ctx->last = newone;
current = newone;
sz = fuse_add_direntry(fill_ctx->req,
current->buf,
current->bufsize - current->off,
filename, &st, current->off);
if (!sz) {
errno = EIO;
ntfs_log_error("Could not add a"
" directory entry (inode %lld)\n",
(unsigned long long)MREF(mref));
}
} else {
sz = 0;
errno = ENOMEM;
}
}
if (sz) {
current->off += sz;
} else {
ret = -1;
errno = EIO; /* ? */
}
}