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);
return __hurd_fail (err), NULL;
}
+ parent = thisdir;
while (thisid != rootid)
{
/* PARENT is a port to the directory we are currently on;
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. */