On Fri, May 02, 2008 at 01:25:30PM +0800, Herbert Xu wrote: > > I suspect the problem is klibc's getcwd implementation but this > should confirm it for us. Actually klibc's getcwd is just fine as it is. It's dash that's relying on glibc extensions of getcwd. This patch sould make it work again. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- commit b306b8c58d10c3fa1a34edc22042e4d9b6185f87 Author: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Date: Fri May 2 14:20:44 2008 +0800 [CD] Restored non-glibc getcwd support These days dash is expected to build with libraries other than glibc so we need to support the old way of calling getcwd again. Thanks to Dan McGee for reporting this bug when dash is built with klibc. Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> diff --git a/ChangeLog b/ChangeLog index f5e0dbc..5216521 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-05-02 Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> + + * Restored non-glibc getcwd support. + 2008-03-07 Larry Doolittle <ldoolitt@xxxxxxxxxxxxxxx> * Fix cmdtxt crash on if statements. diff --git a/src/cd.c b/src/cd.c index 1849c69..0c2f1ee 100644 --- a/src/cd.c +++ b/src/cd.c @@ -241,8 +241,6 @@ updatepwd(const char *dir) } -#define MAXPWD 256 - /* * Find out what the current directory is. If we already know the current * directory, this routine returns immediately. @@ -251,8 +249,13 @@ inline STATIC char * getpwd() { +#ifdef _GNU_SOURCE char *dir = getcwd(0, 0); return dir ? dir : nullstr; +#else + char buf[PATH_MAX]; + return getcwd(buf, sizeof(buf)) ? savestr(buf) : nullstr; +#endif } int -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html