From 36dff600961956c661c3012293ea4c0c2be331e2 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 15 Sep 1997 17:40:15 +0000 Subject: Fix yet a minor stylistic nit from Bruce (Doesn't he have more important things to do ?? :-) Prepare for the likely case of a change in kernel algorithm. --- lib/libc/gen/getcwd.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c index 9f27e906f827..38c911c063db 100644 --- a/lib/libc/gen/getcwd.c +++ b/lib/libc/gen/getcwd.c @@ -89,13 +89,15 @@ getcwd(pt, size) return (NULL); ept = pt + ptsize; } - if (!__getcwd(pt, ept-pt)) { - bpt = pt; - ept = pt + strlen(pt) - 1; - while (bpt < ept) { - c = *bpt; - *bpt++ = *ept; - *ept-- = c; + if (!__getcwd(pt, ept - pt)) { + if (*pt != '/') { + bpt = pt; + ept = pt + strlen(pt) - 1; + while (bpt < ept) { + c = *bpt; + *bpt++ = *ept; + *ept-- = c; + } } return (pt); } -- cgit v1.3