From: David van Moolenbroek Date: Fri, 23 Dec 2011 18:02:57 +0000 (+0100) Subject: hgfs: fix atime/mtime attribute setting bug X-Git-Tag: v3.2.0~152 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/CHANGES?a=commitdiff_plain;h=3e46876a73ffedb65db142e09d1a4e6ee4d630d6;p=minix.git hgfs: fix atime/mtime attribute setting bug Reported and investigated by Antoine Leca. --- diff --git a/common/include/minix/hgfs.h b/common/include/minix/hgfs.h index 1d5a0dd89..96b8f5da4 100644 --- a/common/include/minix/hgfs.h +++ b/common/include/minix/hgfs.h @@ -25,9 +25,12 @@ struct hgfs_attr { #define HGFS_ATTR_MTIME 0x08 /* get/set file modification time */ #define HGFS_ATTR_CTIME 0x10 /* get/set file change time */ #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 \ (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( void hgfs_cleanup, (void) ); diff --git a/lib/libhgfs/attr.c b/lib/libhgfs/attr.c index 12fe0e733..e68138fd0 100644 --- a/lib/libhgfs/attr.c +++ b/lib/libhgfs/attr.c @@ -74,8 +74,8 @@ struct hgfs_attr *attr; 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_ATIME) ? &attr->a_atime : NULL); - time_put((attr->a_mask & HGFS_ATTR_MTIME) ? &attr->a_mtime : NULL); + time_put((attr->a_mask & HGFS_ATTR_ATIME_SET) ? &attr->a_atime : 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); RPC_NEXT8 = HGFS_MODE_TO_PERM(attr->a_mode); diff --git a/servers/hgfs/stat.c b/servers/hgfs/stat.c index 727302c46..d7f04eb1b 100644 --- a/servers/hgfs/stat.c +++ b/servers/hgfs/stat.c @@ -157,7 +157,8 @@ PUBLIC int do_utime() if ((r = verify_inode(ino, path, NULL)) != OK) 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_mtime = m_in.REQ_MODTIME;