diff options
author | phk <phk@FreeBSD.org> | 1997-09-15 17:40:15 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1997-09-15 17:40:15 +0000 |
commit | e9ff6fa415854fb287567c0f9830f46ca52e7ddf (patch) | |
tree | 992c7216b4ce934ea34134199de0e2a7278761b0 | |
parent | 2e5c4c37e1a9a5135d6d52dca66ead582bfaf767 (diff) | |
download | FreeBSD-src-e9ff6fa415854fb287567c0f9830f46ca52e7ddf.zip FreeBSD-src-e9ff6fa415854fb287567c0f9830f46ca52e7ddf.tar.gz |
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.
-rw-r--r-- | lib/libc/gen/getcwd.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c index 9f27e90..38c911c 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); } |