diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cd.c b/src/cd.c index 1849c69..cb6e24d 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 |