summaryrefslogtreecommitdiff
path: root/lib/libc/gen/getcwd.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1997-09-14 16:57:27 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1997-09-14 16:57:27 +0000
commit27262cac335c433fac7556ebe204dcb725f0afe4 (patch)
treec12402b85fe569832338ad06adf5d1148b39e9ea /lib/libc/gen/getcwd.c
parent7822f1c624c42acafde15b5359d3cd8f80ee99fe (diff)
Notes
Diffstat (limited to 'lib/libc/gen/getcwd.c')
-rw-r--r--lib/libc/gen/getcwd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c
index 1593311d4c8a..eb48b5a52b9b 100644
--- a/lib/libc/gen/getcwd.c
+++ b/lib/libc/gen/getcwd.c
@@ -89,6 +89,17 @@ getcwd(pt, size)
return (NULL);
ept = pt + ptsize;
}
+ if (!__getcwd(pt,ptsize)) {
+ char c;
+ bpt = pt;
+ ept = pt + strlen(pt) - 1;
+ while (bpt < ept) {
+ c = *bpt;
+ *bpt++ = *ept;
+ *ept-- = c;
+ }
+ return (pt);
+ }
bpt = ept - 1;
*bpt = '\0';