mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 18:14:24 +08:00
fix: unlink may failed with I/O error
This commit is contained in:
parent
c38e349117
commit
6bbb912bca
@ -1503,7 +1503,7 @@ search:
|
||||
*/
|
||||
if (ni->mrec->link_count) {
|
||||
ntfs_inode_update_times(ni, NTFS_UPDATE_CTIME);
|
||||
goto out;
|
||||
goto ok;
|
||||
}
|
||||
ntfs_attr_reinit_search_ctx(actx);
|
||||
while (!ntfs_attrs_walk(actx)) {
|
||||
@ -1545,12 +1545,16 @@ search:
|
||||
"Leaving inconsistent metadata.\n");
|
||||
}
|
||||
ni = NULL;
|
||||
ok:
|
||||
ntfs_inode_update_times(dir_ni, NTFS_UPDATE_MCTIME);
|
||||
out:
|
||||
if (actx)
|
||||
ntfs_attr_put_search_ctx(actx);
|
||||
if (ictx)
|
||||
ntfs_index_ctx_put(ictx);
|
||||
if (ni && ntfs_inode_close(ni) && !err)
|
||||
if (ntfs_inode_close(dir_ni) && !err)
|
||||
err = errno;
|
||||
if (ntfs_inode_close(ni) && !err)
|
||||
err = errno;
|
||||
if (err) {
|
||||
errno = err;
|
||||
|
@ -1283,20 +1283,16 @@ static int ntfs_fuse_rm(const char *org_path)
|
||||
|
||||
if (ntfs_delete(ni, dir_ni, uname, uname_len))
|
||||
res = -errno;
|
||||
else {
|
||||
/* Inode ctime is updated in ntfs_delete() for hard links. */
|
||||
ntfs_fuse_update_times(dir_ni, NTFS_UPDATE_MCTIME);
|
||||
}
|
||||
/* ntfs_delete() always closes ni and dir_ni */
|
||||
ni = dir_ni = NULL;
|
||||
} else
|
||||
res = -EACCES;
|
||||
/* ntfs_delete() always closes ni */
|
||||
ni = NULL;
|
||||
exit:
|
||||
if (ni && ntfs_inode_close(ni))
|
||||
if (ntfs_inode_close(dir_ni))
|
||||
set_fuse_error(&res);
|
||||
if (ntfs_inode_close(ni))
|
||||
set_fuse_error(&res);
|
||||
free(uname);
|
||||
if (dir_ni && ntfs_inode_close(dir_ni))
|
||||
set_fuse_error(&res);
|
||||
free(path);
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user