From 7ae60af75b78f408420512c58fd5a08ca7a88bad Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 17 Sep 2022 19:47:57 +0000 Subject: hurd: Factorize at/non-at functions Non-at functions can be implemented by just calling the corresponding at function with AT_FDCWD and zero at_flags. In the linkat case, the at behavior is different (O_NOLINK), so this introduces __linkat_common to pass O_NOLINK as appropriate. lstat functions can also be implemented with fstatat by adding __fstatat64_common which takes a flags parameter in addition to the at_flags parameter, In the end this factorizes chmod, chown, link, lstat64, mkdir, readlink, rename, stat64, symlink, unlink, utimes. This also makes __lstat, __lxstat64, __stat and __xstat64 directly use __fstatat64_common instead of __lstat64 or __stat64. --- sysdeps/mach/hurd/mkdir.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'sysdeps/mach/hurd/mkdir.c') diff --git a/sysdeps/mach/hurd/mkdir.c b/sysdeps/mach/hurd/mkdir.c index 06a7c16945..9dbb47b77b 100644 --- a/sysdeps/mach/hurd/mkdir.c +++ b/sysdeps/mach/hurd/mkdir.c @@ -25,19 +25,7 @@ int __mkdir (const char *file_name, mode_t mode) { - error_t err; - const char *name; - file_t parent; - if (!strcmp (file_name, "/")) - return __hurd_fail (EEXIST); - parent = __directory_name_split (file_name, (char **) &name); - if (parent == MACH_PORT_NULL) - return -1; - err = __dir_mkdir (parent, name, mode & ~_hurd_umask); - __mach_port_deallocate (__mach_task_self (), parent); - if (err) - return __hurd_fail (err); - return 0; + return __mkdirat (AT_FDCWD, file_name, mode); } libc_hidden_def (__mkdir) -- cgit 1.4.1