]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Make O_TRUNC update mtime/ctime
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 29 Mar 2020 17:42:55 +0000 (19:42 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 29 Mar 2020 17:42:55 +0000 (19:42 +0200)
* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Call
__file_utimens after __file_set_size.

hurd/lookup-retry.c

index c90eda808d8d49a2f2e88386292fad73867f110a..6d8b05e4e685ffee3a9c64e4afdec282c674ffb2 100644 (file)
@@ -178,8 +178,17 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
              /* We got a successful translation.  Now apply any open-time
                 action flags we were passed.  */
 
-             if (!err && (flags & O_TRUNC)) /* Asked to truncate the file.  */
-               err = __file_set_size (*result, 0);
+             if (!err && (flags & O_TRUNC))
+               {
+                 /* Asked to truncate the file.  */
+                 err = __file_set_size (*result, 0);
+                 if (!err)
+                   {
+                     struct timespec atime = { 0, UTIME_OMIT };
+                     struct timespec mtime = { 0, UTIME_NOW };
+                     __file_utimens (*result, atime, mtime);
+                   }
+               }
 
              if (err)
                __mach_port_deallocate (__mach_task_self (), *result);