diff options
author | Sergey Vlasov <vsu@altlinux.ru> | 2007-01-27 19:29:12 +0300 |
---|---|---|
committer | Sergey Vlasov <vsu@altlinux.ru> | 2007-01-27 19:29:12 +0300 |
commit | 6ab1869fc7bf09d953068f150844ef8bf1e6a813 (patch) | |
tree | 14ab7d8513f0a2bdcf8ed2193d151f3379da2058 | |
parent | 926d1bc9d3e20d3aeae1b948a643ef9eb6bdbe86 (diff) | |
download | klibc-6ab1869fc7bf09d953068f150844ef8bf1e6a813.tar.gz |
[klibc] dash: Fix "pwd -P" breakage due to getcwd(0, 0) usageklibc-1.4.32
The getpwd() function in dash assumed than getcwd(0, 0) will
allocate the buffer dynamically using malloc(); however, this
glibc extension is not implemented by klibc. Make getpwd() use a
temporary buffer and invoke savestr() itself instead of relying on
a nonstandard extension.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
-rw-r--r-- | usr/dash/cd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr/dash/cd.c b/usr/dash/cd.c index 1849c69152bec4..567393fb007109 100644 --- a/usr/dash/cd.c +++ b/usr/dash/cd.c @@ -251,8 +251,9 @@ inline STATIC char * getpwd() { - char *dir = getcwd(0, 0); - return dir ? dir : nullstr; + char buf[PATH_MAX]; + char *dir = getcwd(buf, sizeof(buf)); + return dir ? savestr(dir) : nullstr; } int |