klibc-bot for Ben Hutchings
2020-Mar-28 21:48 UTC
[klibc] [klibc:update-dash] dash: Fix some cosmetic differences from upstream dash
Commit-ID: da8aee4bf2577ec47037705dd09a8ab3e7d5c666 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=da8aee4bf2577ec47037705dd09a8ab3e7d5c666 Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Fri, 25 Jan 2019 00:04:40 +0000 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 20:29:23 +0000 [klibc] dash: Fix some cosmetic differences from upstream dash This is preparation for applying upstream changes. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/bltin/printf.c | 6 +++--- usr/dash/cd.c | 5 ++++- usr/dash/trap.c | 39 ++++++++++++++++++--------------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/usr/dash/bltin/printf.c b/usr/dash/bltin/printf.c index b32b54f8..dcff0992 100644 --- a/usr/dash/bltin/printf.c +++ b/usr/dash/bltin/printf.c @@ -43,14 +43,14 @@ static int conv_escape_str(char *); static char *conv_escape(char *, int *); static int getchr(void); +#ifdef HAVE_STRTOD +static double getdouble(void); +#endif static intmax_t getintmax(void); static uintmax_t getuintmax(void); static char *getstr(void); static char *mklong(const char *, const char *); static void check_conversion(const char *, const char *); -#ifdef HAVE_STRTOD -static double getdouble(void); -#endif static int rval; static char **gargv; diff --git a/usr/dash/cd.c b/usr/dash/cd.c index 89c6c30c..2d9d4b52 100644 --- a/usr/dash/cd.c +++ b/usr/dash/cd.c @@ -254,13 +254,16 @@ getpwd() { #ifdef __GLIBC__ char *dir = getcwd(0, 0); + if (dir) return dir; #else char buf[PATH_MAX]; - if(getcwd(buf, sizeof(buf))) + + if (getcwd(buf, sizeof(buf))) return savestr(buf); #endif + sh_warnx("getcwd() failed: %s", strerror(errno)); return nullstr; } diff --git a/usr/dash/trap.c b/usr/dash/trap.c index 1e2a8677..182fa7ac 100644 --- a/usr/dash/trap.c +++ b/usr/dash/trap.c @@ -395,48 +395,45 @@ out: /* NOTREACHED */ } -/* - * Decode a signal name - */ int decode_signal(const char *string, int minsig) { - int i; + int signo; if (is_number(string)) { - i = atoi(string); - if (i >= NSIG) { + signo = atoi(string); + if (signo >= NSIG) { return -1; } - return i; + return signo; } - for ( i = minsig ; i < NSIG ; i++ ) { - if ( sys_sigabbrev[i] && - !strcasecmp(string, sys_sigabbrev[i]) ) - return i; + for (signo = minsig; signo < NSIG; signo++) { + if (sys_sigabbrev[signo] && + !strcasecmp(string, sys_sigabbrev[signo])) + return signo; } #ifdef SIGRTMIN - if ( !strncasecmp(string, "RTMIN", 5) ) { + if (!strncasecmp(string, "RTMIN", 5)) { char *ep; - if ( string[5] && string[5] != '+' ) + if (string[5] && string[5] != '+') return -1; - i = SIGRTMIN + strtol(string+5, &ep, 10); - if ( *ep || i < SIGRTMIN || i > SIGRTMAX ) + signo = SIGRTMIN + strtol(string+5, &ep, 10); + if (*ep || signo < SIGRTMIN || signo > SIGRTMAX) return -1; - return i; + return signo; } - if ( !strncasecmp(string, "RTMAX", 5) ) { + if (!strncasecmp(string, "RTMAX", 5)) { char *ep; - if ( string[5] && string[5] != '-' ) + if (string[5] && string[5] != '-') return -1; - i = SIGRTMAX + strtol(string+5, &ep, 10); - if ( *ep || i < SIGRTMIN || i > SIGRTMAX ) + signo = SIGRTMAX + strtol(string+5, &ep, 10); + if (*ep || signo < SIGRTMIN || signo > SIGRTMAX) return -1; - return i; + return signo; } #endif
Apparently Analagous Threads
- [klibc:update-dash] dash: Fix some cosmetic differences from upstream dash
- [klibc:update-dash] trap: Implement POSIX.1-2008 trap reset behaviour
- [klibc:update-dash] dash: trap: Implement POSIX.1-2008 trap reset behaviour
- Problems with klibc 1.1.8
- [PATCH] signal.h