From: Miles Bader Date: Tue, 25 Jun 1996 21:48:49 +0000 (+0000) Subject: (_hurd_canonicalize_directory_name_internal): Initialize PARENT to THISDIR, and... X-Git-Tag: cvs/libc-960626~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=315289fbb8910f6826c11a2b352d61c32b5eeb6d;p=thirdparty%2Fglibc.git (_hurd_canonicalize_directory_name_internal): Initialize PARENT to THISDIR, and don't ever deallocate PARENT unless it != THISDIR. --- diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c index 463b28ce290..a167730a0ad 100644 --- a/sysdeps/mach/hurd/getcwd.c +++ b/sysdeps/mach/hurd/getcwd.c @@ -51,7 +51,9 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir, inline void cleanup (void) { - __mach_port_deallocate (__mach_task_self (), parent); + if (parent != thisdir) + __mach_port_deallocate (__mach_task_self (), parent); + __mach_port_deallocate (__mach_task_self (), thisid); __mach_port_deallocate (__mach_task_self (), thisdevid); __mach_port_deallocate (__mach_task_self (), rootid); @@ -101,6 +103,7 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir, return __hurd_fail (err), NULL; } + parent = thisdir; while (thisid != rootid) { /* PARENT is a port to the directory we are currently on; @@ -121,7 +124,8 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir, newp = __file_name_lookup_under (parent, "..", O_READ, 0); if (newp == MACH_PORT_NULL) goto lose; - __mach_port_deallocate (__mach_task_self (), parent); + if (parent != thisdir) + __mach_port_deallocate (__mach_task_self (), parent); parent = newp; /* Get this directory's identity and figure out if it's a mount point. */