mirror of git://sourceware.org/git/glibc.git
Hurd: Fix port deallocation on mknod error.
This commit is contained in:
parent
f34d6f840e
commit
918d4d7163
|
@ -1,5 +1,8 @@
|
||||||
2012-05-10 Samuel Thibault <samuel.thibault@ens-lyon.org>
|
2012-05-10 Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||||
|
|
||||||
|
* sysdeps/mach/hurd/xmknodat.c (__xmknodat): Deallocate NODE port only
|
||||||
|
if __dir_mkfile succeeded.
|
||||||
|
|
||||||
* sysdeps/mach/hurd/dup3.c: Lock _hurd_dtable_lock before
|
* sysdeps/mach/hurd/dup3.c: Lock _hurd_dtable_lock before
|
||||||
checking for _hurd_dtablesize. Unlock it right after having
|
checking for _hurd_dtablesize. Unlock it right after having
|
||||||
finished _hurd_dtable allocation.
|
finished _hurd_dtable allocation.
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* Create a device file relative to an open directory. Hurd version.
|
/* Create a device file relative to an open directory. Hurd version.
|
||||||
Copyright (C) 1991,1992,1993,1994,1995,1996,1999,2002,2005,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
|
||||||
|
@ -34,7 +33,7 @@
|
||||||
int
|
int
|
||||||
__xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
|
__xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
|
||||||
{
|
{
|
||||||
error_t err;
|
error_t errnode, err;
|
||||||
file_t dir, node;
|
file_t dir, node;
|
||||||
char *name;
|
char *name;
|
||||||
char buf[100], *bp;
|
char buf[100], *bp;
|
||||||
|
@ -94,7 +93,7 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Create a new, unlinked node in the target directory. */
|
/* Create a new, unlinked node in the target directory. */
|
||||||
err = __dir_mkfile (dir, O_WRITE, (mode & ~S_IFMT) & ~_hurd_umask, &node);
|
errnode = err = __dir_mkfile (dir, O_WRITE, (mode & ~S_IFMT) & ~_hurd_umask, &node);
|
||||||
|
|
||||||
if (! err && translator != NULL)
|
if (! err && translator != NULL)
|
||||||
/* Set the node's translator to make it a device. */
|
/* Set the node's translator to make it a device. */
|
||||||
|
@ -109,6 +108,7 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
|
||||||
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 (), dir);
|
||||||
|
if (! errnode)
|
||||||
__mach_port_deallocate (__mach_task_self (), node);
|
__mach_port_deallocate (__mach_task_self (), node);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
|
|
Loading…
Reference in New Issue