fix ntfs_readdir(): return with error if filldir() fails

master
szaka 2007-08-08 16:15:15 +00:00
parent 99ed44885f
commit 3b0d3efe40
1 changed files with 5 additions and 11 deletions

View File

@ -724,7 +724,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
le16_to_cpu(dir_ni->mrec->sequence_number)),
NTFS_DT_DIR);
if (rc)
goto done;
goto err_out;
++*pos;
}
if (*pos == 1) {
@ -739,7 +739,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
rc = filldir(dirent, dotdot, 2, FILE_NAME_POSIX, *pos,
parent_mref, NTFS_DT_DIR);
if (rc)
goto done;
goto err_out;
++*pos;
}
@ -816,7 +816,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
if (rc) {
ntfs_attr_put_search_ctx(ctx);
ctx = NULL;
goto done;
goto err_out;
}
}
ntfs_attr_put_search_ctx(ctx);
@ -965,7 +965,7 @@ find_next_index_buffer:
rc = ntfs_filldir(dir_ni, pos, index_vcn_size_bits,
INDEX_TYPE_ALLOCATION, ia, ie, dirent, filldir);
if (rc)
goto done;
goto err_out;
}
goto find_next_index_buffer;
EOD:
@ -978,13 +978,7 @@ done:
ntfs_attr_close(bmp_na);
if (ia_na)
ntfs_attr_close(ia_na);
#ifdef DEBUG
if (!rc)
ntfs_log_debug("EOD, *pos 0x%llx, returning 0.\n", (long long)*pos);
else
ntfs_log_debug("filldir returned %i, *pos 0x%llx, returning 0.\n",
rc, (long long)*pos);
#endif
ntfs_log_debug("EOD, *pos 0x%llx, returning 0.\n", (long long)*pos);
return 0;
dir_err_out:
errno = EIO;