about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-06-26 17:44:44 +0000
committerMiles Bader <miles@gnu.org>1996-06-26 17:44:44 +0000
commitaeb0816f97b5f6cd6d1ca1a1e5dc461c1bcc3403 (patch)
treed940da846aae33fd4683d091e0c337f64edd98d9
parentbba7bb78f3bc3be2dacafc336d1342fcc5c57489 (diff)
downloadglibc-aeb0816f97b5f6cd6d1ca1a1e5dc461c1bcc3403.tar.gz
glibc-aeb0816f97b5f6cd6d1ca1a1e5dc461c1bcc3403.tar.xz
glibc-aeb0816f97b5f6cd6d1ca1a1e5dc461c1bcc3403.zip
(_hurd_canonicalize_directory_name_internal): Don't deallocate DOTID & DOTDEVID until we're finished with them (we need to keep them at least until we've fetched the next level of id ports, so that mach will be able to use the same name if they're the same). Add inner_errlose: label, which deallocates DOTID & DOTDEVID and jumps to errlose, for those places where such cleanup is needed.
-rw-r--r--sysdeps/mach/hurd/getcwd.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c
index a167730a0a..daa67fb858 100644
--- a/sysdeps/mach/hurd/getcwd.c
+++ b/sysdeps/mach/hurd/getcwd.c
@@ -131,8 +131,6 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir,
       /* Get this directory's identity and figure out if it's a mount point. */
       if (err = __io_identity (parent, &dotid, &dotdevid, &dotino))
 	goto errlose;
-      __mach_port_deallocate (__mach_task_self (), dotid);
-      __mach_port_deallocate (__mach_task_self (), dotdevid);
       mount_point = dotdevid != thisdevid;
 
       /* Search for the last directory.  */
@@ -186,7 +184,7 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir,
 		  err = __io_identity (try, &id, &devid, &fileno);
 		  __mach_port_deallocate (__mach_task_self (), try);
 		  if (err)
-		    goto errlose;
+		    goto inner_errlose;
 		  __mach_port_deallocate (__mach_task_self (), id);
 		  __mach_port_deallocate (__mach_task_self (), devid);
 		  if (id == thisid)
@@ -196,14 +194,19 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir,
 	}
 
       if (err)
-	goto errlose;
+	{
+	inner_errlose:		/* Goto ERRLOSE: after cleaning up.  */
+	  __mach_port_deallocate (__mach_task_self (), dotid);
+	  __mach_port_deallocate (__mach_task_self (), dotdevid);
+	  goto errlose;
+	}
       else if (nentries == 0)
 	{
 	  /* We got to the end of the directory without finding anything!
 	     We are in a directory that has been unlinked, or something is
 	     broken.  */
 	  err = ENOENT;
-	  goto errlose;
+	  goto inner_errlose;
 	}
       else
       found: