From f0f930d60cd62f5fe5ba28460b43f333e8062b94 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Fri, 2 May 2008 14:23:47 +0800 Subject: [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 --- ChangeLog | 4 ++++ src/cd.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f5e0dbc..5216521 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-05-02 Herbert Xu + + * Restored non-glibc getcwd support. + 2008-03-07 Larry Doolittle * Fix cmdtxt crash on if statements. 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 -- cgit 1.4.1 1b7294d&follow=1'>diff
Commit message (Expand)Author
2020-03-09Replace sys_nsig with NSIGJune McEnroe
2020-03-09Replace 1sh MakefileJune McEnroe
2020-03-09Rename manual pages to 1shJune McEnroe
2020-03-09Move bltin out of subdirectoryJune McEnroe
2020-03-09Import /usr/src/usr.bin/printf from FreeBSD 12.1-RELEASEJune McEnroe
2020-03-09Import /usr/src/bin/test from FreeBSD 12.1-RELEASEJune McEnroe
2020-03-09Import /usr/src/bin/kill from FreeBSD 12.1-RELEASEJune McEnroe
2020-03-09Remove extraneous files from sh sourcesJune McEnroe
2020-03-09Import /usr/src/bin/sh from FreeBSD 12.1-RELEASEJune McEnroe
2020-03-09Remove 1sh sourcesJune McEnroe
2020-03-08Add The Stone SkyJune McEnroe
2020-03-08Publish "How I Relay Chat"June McEnroe
2020-03-03Don't use $ inside $(())June McEnroe
2020-03-03Remove setoptJune McEnroe
2020-03-03Use getopts in shell scriptsJune McEnroe
2020-02-27Style %T outside of Rs in italicJune McEnroe
2020-02-26Add Fierce Femmes and Notorious LiarsJune McEnroe
2020-02-23Add This Is How You Lose the Time WarJune McEnroe
2020-02-22Add See Ya LaterJune McEnroe
2020-02-20Remove wiki scriptJune McEnroe
2020-02-19Add The Obelisk GateJune McEnroe
2020-02-17Add Four Tet — HandsJune McEnroe
2020-02-12Simplify macOS notify-sendJune McEnroe
2020-02-12Add imbox and notemap to pageJune McEnroe
2020-02-12Collapse simple linksJune McEnroe
2020-02-12Move catgirl up the pageJune McEnroe
2020-02-12Update catgirl pty grabJune McEnroe
2020-02-12Link to cgit /about pages where appropriateJune McEnroe
2020-02-11Separate LINKS from BINS for html to workJune McEnroe
2020-02-11Add margin to Bl-bullet itemsJune McEnroe
2020-02-10Match URLs inside parens or with paired parens insideJune McEnroe
2020-02-10Duplicate effective URL before passing it back to curlJune McEnroe
2020-02-09Add To Be Taught, If FortunateJune McEnroe
2020-02-04Add The Future of Another TimelineJune McEnroe
2020-01-31Reorganize the Makefile for the umpteenth timeJune McEnroe
2020-01-28Change scout sensitivity to 1.4June McEnroe
2020-01-28Import shows.txtJune McEnroe