summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1997-09-15 17:40:15 +0000
committerphk <phk@FreeBSD.org>1997-09-15 17:40:15 +0000
commite9ff6fa415854fb287567c0f9830f46ca52e7ddf (patch)
tree992c7216b4ce934ea34134199de0e2a7278761b0
parent2e5c4c37e1a9a5135d6d52dca66ead582bfaf767 (diff)
downloadFreeBSD-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.c16
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);
}
OpenPOWER on IntegriCloud