diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-01-07 01:36:43 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-01-07 01:36:43 +0100 |
commit | 75fed76dfd8e1e7f45fb9b346d0f70f687d736cd (patch) | |
tree | db50756507f62076290848abdb5f7550d62af815 /sysdeps/mach | |
parent | fb1059d42a9df2f1ef4d75700724ad2940a09aad (diff) | |
download | glibc-75fed76dfd8e1e7f45fb9b346d0f70f687d736cd.zip glibc-75fed76dfd8e1e7f45fb9b346d0f70f687d736cd.tar.gz glibc-75fed76dfd8e1e7f45fb9b346d0f70f687d736cd.tar.bz2 |
hurd: Accept null arguments for utimensat pathname
This follows Linux' behavior, making it a replacement for the futimens
interface.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/utimensat.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sysdeps/mach/hurd/utimensat.c b/sysdeps/mach/hurd/utimensat.c index 9796869..4d0edc0 100644 --- a/sysdeps/mach/hurd/utimensat.c +++ b/sysdeps/mach/hurd/utimensat.c @@ -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; |