2 Apr 2010 07:26
[PATCH] [klibc] dash: cd fix getpwd
<y <at> dual.stro.at>
2010-04-02 05:26:26 GMT
2010-04-02 05:26:26 GMT
From: maximilian attems <max <at> stro.at>
On review of klibc dash changes:
"Hmm, this breaks the non-glibc case. You're now returning a pointer to a
string on the stack which is illegal." Herbert Xu
Use upstream dash way.
Signed-off-by: maximilian attems <max <at> stro.at>
Cc: Herbert Xu <herbert <at> gondor.apana.org.au>
---
usr/dash/cd.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/usr/dash/cd.c b/usr/dash/cd.c
index 8a23110..ba9a1bc 100644
--- a/usr/dash/cd.c
+++ b/usr/dash/cd.c
<at> <at> -253,12 +253,13 <at> <at> getpwd()
{
#ifdef __GLIBC__
char *dir = getcwd(0, 0);
+ if (dir)
+ return dir;
#else
char buf[PATH_MAX];
- char *dir = getcwd(buf, sizeof(buf));
+ if(getcwd(buf, sizeof(buf)))
+ return savestr(buf);
#endif
- if (dir)
- return dir;
sh_warnx("getcwd() failed: %s", strerror(errno));
return nullstr;
}
--
--
1.7.0.3
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
RSS Feed