diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 1997-09-15 17:40:15 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1997-09-15 17:40:15 +0000 |
| commit | 36dff600961956c661c3012293ea4c0c2be331e2 (patch) | |
| tree | 6db5cb8e3ad2096dfeef6f9ed42259260e9076f6 /lib/libc | |
| parent | 11210c4ed5a6c5fba3fcaddb717f231f485dd07c (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -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 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); } |
