(_hurd_canonicalize_directory_name_internal): Initialize PARENT to THISDIR, and don't ever deallocate PARENT unless it != THISDIR.

This commit is contained in:
Miles Bader 1996-06-25 21:48:49 +00:00
parent 622586fbe0
commit 315289fbb8
1 changed files with 6 additions and 2 deletions

View File

@ -51,7 +51,9 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir,
inline void cleanup (void) inline void cleanup (void)
{ {
if (parent != thisdir)
__mach_port_deallocate (__mach_task_self (), parent); __mach_port_deallocate (__mach_task_self (), parent);
__mach_port_deallocate (__mach_task_self (), thisid); __mach_port_deallocate (__mach_task_self (), thisid);
__mach_port_deallocate (__mach_task_self (), thisdevid); __mach_port_deallocate (__mach_task_self (), thisdevid);
__mach_port_deallocate (__mach_task_self (), rootid); __mach_port_deallocate (__mach_task_self (), rootid);
@ -101,6 +103,7 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir,
return __hurd_fail (err), NULL; return __hurd_fail (err), NULL;
} }
parent = thisdir;
while (thisid != rootid) while (thisid != rootid)
{ {
/* PARENT is a port to the directory we are currently on; /* PARENT is a port to the directory we are currently on;
@ -121,6 +124,7 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir,
newp = __file_name_lookup_under (parent, "..", O_READ, 0); newp = __file_name_lookup_under (parent, "..", O_READ, 0);
if (newp == MACH_PORT_NULL) if (newp == MACH_PORT_NULL)
goto lose; goto lose;
if (parent != thisdir)
__mach_port_deallocate (__mach_task_self (), parent); __mach_port_deallocate (__mach_task_self (), parent);
parent = newp; parent = newp;