hgfs: fix atime/mtime attribute setting bug

Reported and investigated by Antoine Leca.
This commit is contained in:
David van Moolenbroek 2011-12-23 19:02:57 +01:00
parent 80b03d929d
commit 3e46876a73
3 changed files with 8 additions and 4 deletions

View file

@ -25,9 +25,12 @@ struct hgfs_attr {
#define HGFS_ATTR_MTIME 0x08 /* get/set file modification time */ #define HGFS_ATTR_MTIME 0x08 /* get/set file modification time */
#define HGFS_ATTR_CTIME 0x10 /* get/set file change time */ #define HGFS_ATTR_CTIME 0x10 /* get/set file change time */
#define HGFS_ATTR_MODE 0x20 /* get/set file mode */ #define HGFS_ATTR_MODE 0x20 /* get/set file mode */
#define HGFS_ATTR_ATIME_SET 0x40 /* set specific file access time */
#define HGFS_ATTR_MTIME_SET 0x80 /* set specific file modify time */
#define HGFS_ATTR_ALL \ #define HGFS_ATTR_ALL \
(HGFS_ATTR_SIZE | HGFS_ATTR_CRTIME | HGFS_ATTR_ATIME | \ (HGFS_ATTR_SIZE | HGFS_ATTR_CRTIME | HGFS_ATTR_ATIME | \
HGFS_ATTR_MTIME | HGFS_ATTR_CTIME | HGFS_ATTR_MODE) HGFS_ATTR_MTIME | HGFS_ATTR_CTIME | HGFS_ATTR_MODE | \
HGFS_ATTR_ATIME_SET | HGFS_ATTR_MTIME_SET)
_PROTOTYPE( int hgfs_init, (void) ); _PROTOTYPE( int hgfs_init, (void) );
_PROTOTYPE( void hgfs_cleanup, (void) ); _PROTOTYPE( void hgfs_cleanup, (void) );

View file

@ -74,8 +74,8 @@ struct hgfs_attr *attr;
RPC_NEXT32 = ex64hi(attr->a_size); RPC_NEXT32 = ex64hi(attr->a_size);
time_put((attr->a_mask & HGFS_ATTR_CRTIME) ? &attr->a_crtime : NULL); time_put((attr->a_mask & HGFS_ATTR_CRTIME) ? &attr->a_crtime : NULL);
time_put((attr->a_mask & HGFS_ATTR_ATIME) ? &attr->a_atime : NULL); time_put((attr->a_mask & HGFS_ATTR_ATIME_SET) ? &attr->a_atime : NULL);
time_put((attr->a_mask & HGFS_ATTR_MTIME) ? &attr->a_mtime : NULL); time_put((attr->a_mask & HGFS_ATTR_MTIME_SET) ? &attr->a_mtime : NULL);
time_put((attr->a_mask & HGFS_ATTR_CTIME) ? &attr->a_ctime : NULL); time_put((attr->a_mask & HGFS_ATTR_CTIME) ? &attr->a_ctime : NULL);
RPC_NEXT8 = HGFS_MODE_TO_PERM(attr->a_mode); RPC_NEXT8 = HGFS_MODE_TO_PERM(attr->a_mode);

View file

@ -157,7 +157,8 @@ PUBLIC int do_utime()
if ((r = verify_inode(ino, path, NULL)) != OK) if ((r = verify_inode(ino, path, NULL)) != OK)
return r; return r;
attr.a_mask = HGFS_ATTR_ATIME | HGFS_ATTR_MTIME; attr.a_mask = HGFS_ATTR_ATIME | HGFS_ATTR_MTIME | HGFS_ATTR_ATIME_SET |
HGFS_ATTR_MTIME_SET;
attr.a_atime = m_in.REQ_ACTIME; attr.a_atime = m_in.REQ_ACTIME;
attr.a_mtime = m_in.REQ_MODTIME; attr.a_mtime = m_in.REQ_MODTIME;