aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2012-05-10 15:52:43 -0700
committerRoland McGrath <roland@hack.frob.com>2012-05-10 15:57:28 -0700
commit918d4d716343a54ce97aefb13d20fa8f4e1d03de (patch)
treed8578d996c8566e0165ce3f36f4a7e53bd7b6b55 /sysdeps
parentf34d6f840eaba45a82fa8d20922fc2d678968fb7 (diff)
downloadglibc-918d4d716343a54ce97aefb13d20fa8f4e1d03de.tar
glibc-918d4d716343a54ce97aefb13d20fa8f4e1d03de.tar.gz
glibc-918d4d716343a54ce97aefb13d20fa8f4e1d03de.tar.bz2
glibc-918d4d716343a54ce97aefb13d20fa8f4e1d03de.zip
Hurd: Fix port deallocation on mknod error.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/xmknodat.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sysdeps/mach/hurd/xmknodat.c b/sysdeps/mach/hurd/xmknodat.c
index acd1a8c683..645f222809 100644
--- a/sysdeps/mach/hurd/xmknodat.c
+++ b/sysdeps/mach/hurd/xmknodat.c
@@ -1,6 +1,5 @@
/* Create a device file relative to an open directory. Hurd version.
- Copyright (C) 1991,1992,1993,1994,1995,1996,1999,2002,2005,2006
- 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
@@ -34,7 +33,7 @@
int
__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;
char *name;
char buf[100], *bp;
@@ -94,7 +93,7 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
return -1;
/* 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)
/* Set the node's translator to make it a device. */
@@ -109,7 +108,8 @@ __xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
err = __dir_link (dir, node, name, 1);
__mach_port_deallocate (__mach_task_self (), dir);
- __mach_port_deallocate (__mach_task_self (), node);
+ if (! errnode)
+ __mach_port_deallocate (__mach_task_self (), node);
if (err)
return __hurd_fail (err);