Hurd: fix symlink/symlinkat error case not to do an extraneous __mach_port_deallocate.
This commit is contained in:
parent
f23f459dd3
commit
87ef29ca94
|
@ -1,3 +1,10 @@
|
||||||
|
2012-04-24 Roland McGrath <roland@hack.frob.com>
|
||||||
|
|
||||||
|
* sysdeps/mach/hurd/symlink.c: Don't call __mach_port_deallocate on
|
||||||
|
NODE when __dir_mkfile failed.
|
||||||
|
* sysdeps/mach/hurd/symlinkat.c: Likewise.
|
||||||
|
Reported by Ludovic Courtès <ludo@gnu.org>.
|
||||||
|
|
||||||
2012-04-24 Andreas Jaeger <aj@suse.de>
|
2012-04-24 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
* Makerules (common-clean): Also remove gen-as-const-headers
|
* Makerules (common-clean): Also remove gen-as-const-headers
|
||||||
|
|
|
@ -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.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -46,6 +46,7 @@ __symlink (from, to)
|
||||||
err = __dir_mkfile (dir, O_WRITE, 0777 & ~_hurd_umask, &node);
|
err = __dir_mkfile (dir, O_WRITE, 0777 & ~_hurd_umask, &node);
|
||||||
|
|
||||||
if (! err)
|
if (! err)
|
||||||
|
{
|
||||||
/* Set the node's translator to make it a symlink. */
|
/* Set the node's translator to make it a symlink. */
|
||||||
err = __file_set_translator (node,
|
err = __file_set_translator (node,
|
||||||
FS_TRANS_EXCL|FS_TRANS_SET,
|
FS_TRANS_EXCL|FS_TRANS_SET,
|
||||||
|
@ -57,8 +58,10 @@ __symlink (from, to)
|
||||||
/* Link the node, now a valid symlink, into the target directory. */
|
/* Link the node, now a valid symlink, into the target directory. */
|
||||||
err = __dir_link (dir, node, name, 1);
|
err = __dir_link (dir, node, name, 1);
|
||||||
|
|
||||||
__mach_port_deallocate (__mach_task_self (), dir);
|
|
||||||
__mach_port_deallocate (__mach_task_self (), node);
|
__mach_port_deallocate (__mach_task_self (), node);
|
||||||
|
}
|
||||||
|
|
||||||
|
__mach_port_deallocate (__mach_task_self (), dir);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
return __hurd_fail (err);
|
return __hurd_fail (err);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* Create a symbolic link named relative to an open directory. Hurd version.
|
/* Create a symbolic link named relative to an open directory. Hurd version.
|
||||||
Copyright (C) 1991,1992,1993,1994,1995,1996,1997,2006
|
Copyright (C) 1991-2012 Free Software Foundation, Inc.
|
||||||
Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -53,6 +52,7 @@ symlinkat (from, fd, to)
|
||||||
err = __dir_mkfile (dir, O_WRITE, 0777 & ~_hurd_umask, &node);
|
err = __dir_mkfile (dir, O_WRITE, 0777 & ~_hurd_umask, &node);
|
||||||
|
|
||||||
if (! err)
|
if (! err)
|
||||||
|
{
|
||||||
/* Set the node's translator to make it a symlink. */
|
/* Set the node's translator to make it a symlink. */
|
||||||
err = __file_set_translator (node,
|
err = __file_set_translator (node,
|
||||||
FS_TRANS_EXCL|FS_TRANS_SET,
|
FS_TRANS_EXCL|FS_TRANS_SET,
|
||||||
|
@ -64,8 +64,10 @@ symlinkat (from, fd, to)
|
||||||
/* Link the node, now a valid symlink, into the target directory. */
|
/* Link the node, now a valid symlink, into the target directory. */
|
||||||
err = __dir_link (dir, node, name, 1);
|
err = __dir_link (dir, node, name, 1);
|
||||||
|
|
||||||
__mach_port_deallocate (__mach_task_self (), dir);
|
|
||||||
__mach_port_deallocate (__mach_task_self (), node);
|
__mach_port_deallocate (__mach_task_self (), node);
|
||||||
|
}
|
||||||
|
|
||||||
|
__mach_port_deallocate (__mach_task_self (), dir);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
return __hurd_fail (err);
|
return __hurd_fail (err);
|
||||||
|
|
Loading…
Reference in New Issue