summaryrefslogtreecommitdiff
path: root/libdiskfs/dir-lookup.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdiskfs/dir-lookup.c')
-rw-r--r--libdiskfs/dir-lookup.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c
index 8b986e49..c50970d2 100644
--- a/libdiskfs/dir-lookup.c
+++ b/libdiskfs/dir-lookup.c
@@ -421,24 +421,25 @@ diskfs_S_dir_lookup (struct protid *dircred,
memcpy (pathbuf + np->dn_stat.st_size + 1,
nextname, nextnamelen - 1);
}
- pathbuf[nextnamelen + np->dn_stat.st_size] = '\0';
+ if (mustbedir)
+ {
+ pathbuf[nextnamelen + np->dn_stat.st_size] = '/';
+ pathbuf[nextnamelen + np->dn_stat.st_size + 1] = '\0';
+ }
+ else
+ pathbuf[nextnamelen + np->dn_stat.st_size] = '\0';
if (pathbuf[0] == '/')
{
/* Punt to the caller. */
*retry = FS_RETRY_MAGICAL;
*returned_port = MACH_PORT_NULL;
- memcpy (retryname, pathbuf,
- nextnamelen + np->dn_stat.st_size + 1);
- if (mustbedir)
- {
- retryname[nextnamelen + np->dn_stat.st_size] = '/';
- retryname[nextnamelen + np->dn_stat.st_size + 1] = '\0';
- }
+ strcpy (retryname, pathbuf);
goto out;
}
path = pathbuf;
+ mustbedir = 0;
}
if (lastcomp)