diff options
author | Roland McGrath <roland@hack.frob.com> | 2012-04-24 13:12:12 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2012-04-24 13:13:16 -0700 |
commit | 87ef29ca94bb5b4bb6a0b8ef40d387470d4baac3 (patch) | |
tree | cbdbfad84c2439b923a1918bdf338ceb0dfb0781 /sysdeps/mach/hurd/symlink.c | |
parent | f23f459dd38eaf61cb574c7312599975e13468a9 (diff) | |
download | glibc-87ef29ca94bb5b4bb6a0b8ef40d387470d4baac3.tar.gz glibc-87ef29ca94bb5b4bb6a0b8ef40d387470d4baac3.tar.xz glibc-87ef29ca94bb5b4bb6a0b8ef40d387470d4baac3.zip |
Hurd: fix symlink/symlinkat error case not to do an extraneous __mach_port_deallocate.
Diffstat (limited to 'sysdeps/mach/hurd/symlink.c')
-rw-r--r-- | sysdeps/mach/hurd/symlink.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sysdeps/mach/hurd/symlink.c b/sysdeps/mach/hurd/symlink.c index 8bca405139..0754b1893b 100644 --- a/sysdeps/mach/hurd/symlink.c +++ b/sysdeps/mach/hurd/symlink.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. +/* Copyright (C) 1991-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -46,19 +46,22 @@ __symlink (from, to) err = __dir_mkfile (dir, O_WRITE, 0777 & ~_hurd_umask, &node); if (! err) - /* Set the node's translator to make it a symlink. */ - err = __file_set_translator (node, - FS_TRANS_EXCL|FS_TRANS_SET, - FS_TRANS_EXCL|FS_TRANS_SET, 0, - buf, sizeof (_HURD_SYMLINK) + len, - MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND); + { + /* Set the node's translator to make it a symlink. */ + err = __file_set_translator (node, + FS_TRANS_EXCL|FS_TRANS_SET, + FS_TRANS_EXCL|FS_TRANS_SET, 0, + buf, sizeof (_HURD_SYMLINK) + len, + MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND); - if (! err) - /* Link the node, now a valid symlink, into the target directory. */ - err = __dir_link (dir, node, name, 1); + if (! err) + /* Link the node, now a valid symlink, into the target directory. */ + err = __dir_link (dir, node, name, 1); + + __mach_port_deallocate (__mach_task_self (), node); + } __mach_port_deallocate (__mach_task_self (), dir); - __mach_port_deallocate (__mach_task_self (), node); if (err) return __hurd_fail (err); |