mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-27 12:03:42 +08:00
fix: utimes() shouldn't update the parent dir mtime (Wayne Sherman, Szaka)
This commit is contained in:
parent
96d2e7e24f
commit
d2fab4e71f
@ -49,6 +49,7 @@ typedef enum {
|
||||
NI_FileNameDirty, /* 1: FILE_NAME attributes need to be updated
|
||||
in the index. */
|
||||
NI_NoMtimeUpdate, /* 1: Don't update modifiction time. */
|
||||
NI_NoParentMtimeUpdate, /* 1: Don't update parent dir's mtime. */
|
||||
} ntfs_inode_state_bits;
|
||||
|
||||
#define test_nino_flag(ni, flag) test_bit(NI_##flag, (ni)->state)
|
||||
@ -102,6 +103,11 @@ typedef enum {
|
||||
#define NInoClearNoMtimeUpdate(ni) clear_nino_flag(ni, NoMtimeUpdate)
|
||||
#define NInoMtimeUpdate(ni) (!NInoNoMtimeUpdate(ni))
|
||||
|
||||
#define NInoNoParentMtimeUpdate(ni) test_nino_flag(ni, NoMtimeUpdate)
|
||||
#define NInoSetNoParentMtimeUpdate(ni) set_nino_flag(ni, NoMtimeUpdate)
|
||||
#define NInoClearNoParentMtimeUpdate(ni) clear_nino_flag(ni, NoMtimeUpdate)
|
||||
#define NInoParentMtimeUpdate(ni) (!NInoNoParentMtimeUpdate(ni))
|
||||
|
||||
/**
|
||||
* struct _ntfs_inode - The NTFS in-memory inode structure.
|
||||
*
|
||||
|
@ -686,6 +686,7 @@ int ntfs_inode_sync(ntfs_inode *ni)
|
||||
/* Update FILE_NAME's in the index. */
|
||||
if ((ni->mrec->flags & MFT_RECORD_IN_USE) && ni->nr_extents != -1 &&
|
||||
NInoFileNameTestAndClearDirty(ni) &&
|
||||
NInoParentMtimeUpdate(ni) &&
|
||||
ntfs_inode_sync_file_name(ni)) {
|
||||
if (!err || errno == EIO) {
|
||||
err = errno;
|
||||
|
@ -1245,6 +1245,9 @@ static int ntfs_fuse_utime(const char *path, struct utimbuf *buf)
|
||||
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
|
||||
if (!ni)
|
||||
return -errno;
|
||||
|
||||
NInoSetNoParentMtimeUpdate(ni);
|
||||
|
||||
if (buf) {
|
||||
ni->last_access_time = buf->actime;
|
||||
ni->last_data_change_time = buf->modtime;
|
||||
|
Loading…
Reference in New Issue
Block a user