]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Accept null arguments for utimensat pathname
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Tue, 7 Jan 2025 00:36:43 +0000 (01:36 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Tue, 7 Jan 2025 00:36:43 +0000 (01:36 +0100)
This follows Linux' behavior, making it a replacement for the futimens
interface.

sysdeps/mach/hurd/utimensat.c

index 97968690e9fd541af15f634455157b04b9e53992..4d0edc096268c410f4640e6e08cf5ba2ec4d5e4b 100644 (file)
@@ -33,13 +33,19 @@ utimensat (int fd, const char *file, const struct timespec tsp[2],
   error_t err;
   file_t port;
 
-  port = __file_name_lookup_at (fd, flags, file, 0, 0);
-  if (port == MACH_PORT_NULL)
-    return -1;
+  if (file)
+    {
+      port = __file_name_lookup_at (fd, flags, file, 0, 0);
+      if (port == MACH_PORT_NULL)
+       return -1;
 
-  err = hurd_futimens (port, tsp);
+      err = hurd_futimens (port, tsp);
+
+      __mach_port_deallocate (__mach_task_self (), port);
+    }
+  else
+    err = HURD_DPORT_USE (fd, hurd_futimens (port, tsp));
 
-  __mach_port_deallocate (__mach_task_self (), port);
   if (err)
     return __hurd_fail (err);
   return 0;