diff options
Diffstat (limited to 'sysdeps/mach/hurd/link.c')
-rw-r--r-- | sysdeps/mach/hurd/link.c | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/sysdeps/mach/hurd/link.c b/sysdeps/mach/hurd/link.c index 48856bdce9..2267ae0732 100644 --- a/sysdeps/mach/hurd/link.c +++ b/sysdeps/mach/hurd/link.c @@ -20,39 +20,13 @@ #include <unistd.h> #include <hurd.h> +#include <linkat_common.h> + /* Make a link to FROM called TO. */ int __link (const char *from, const char *to) { - error_t err; - file_t oldfile, linknode, todir; - char *toname; - - oldfile = __file_name_lookup (from, 0, 0); - if (oldfile == MACH_PORT_NULL) - return -1; - - /* The file_getlinknode RPC returns the port that should be passed to - the receiving filesystem (the one containing TODIR) in dir_link. */ - - err = __file_getlinknode (oldfile, &linknode); - __mach_port_deallocate (__mach_task_self (), oldfile); - if (err) - return __hurd_fail (err); - - todir = __file_name_split (to, &toname); - if (todir != MACH_PORT_NULL) - { - err = __dir_link (todir, linknode, toname, 1); - __mach_port_deallocate (__mach_task_self (), todir); - } - __mach_port_deallocate (__mach_task_self (), linknode); - if (todir == MACH_PORT_NULL) - return -1; - - if (err) - return __hurd_fail (err); - return 0; + return __linkat_common (AT_FDCWD, from, AT_FDCWD, to, 0, 0); } weak_alias (__link, link) |