From 75fed76dfd8e1e7f45fb9b346d0f70f687d736cd Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 7 Jan 2025 01:36:43 +0100 Subject: hurd: Accept null arguments for utimensat pathname This follows Linux' behavior, making it a replacement for the futimens interface. --- sysdeps/mach/hurd/utimensat.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'sysdeps/mach') 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; -- cgit v1.1