diff --git a/NEWS b/NEWS index ae1c17648..2642fa28d 100644 --- a/NEWS +++ b/NEWS @@ -858,7 +858,7 @@ Any uppercase BUG_* names are modernish shell bug IDs. the parent environment was corrupted or the shell crashed. When a redirection was used in a DEBUG trap action, the trap was disabled. DEBUG traps were also incorrectly inherited by subshells and ksh functions. - All this was caused by a bug introduced in ksh 93t 2008-07-25. + All this was caused by a bug introduced in ksh 93t 2008-06-24. 2021-01-22: @@ -869,7 +869,7 @@ Any uppercase BUG_* names are modernish shell bug IDs. - Fixed: executing a DEBUG trap in a command substitution had side effects on the exit status ($?) of non-trap commands. - This bug was introduced in ksh 93t 2008-11-04. + This bug was introduced in ksh 93t 2008-09-21. - The typeset builtin command now gives an informative error message if an incompatible combination of options is given. diff --git a/src/cmd/ksh93/bltins/print.c b/src/cmd/ksh93/bltins/print.c index 942cfb2b6..d23973b8b 100644 --- a/src/cmd/ksh93/bltins/print.c +++ b/src/cmd/ksh93/bltins/print.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2014 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -21,7 +21,7 @@ /* * echo [arg...] * print [-enprsvC] [-f format] [-u fd] [string ...] - * printf format [string ...] + * printf [-v var] format [string ...] * * David Korn * AT&T Labs diff --git a/src/cmd/ksh93/bltins/typeset.c b/src/cmd/ksh93/bltins/typeset.c index e54f1e8fe..878a2ffa6 100644 --- a/src/cmd/ksh93/bltins/typeset.c +++ b/src/cmd/ksh93/bltins/typeset.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -699,13 +699,15 @@ static int setall(char **argv,register int flag,Dt_t *troot,struct tdata *tp np = sh_fsearch(name,HASH_NOSCOPE); if(!np) #endif /* SHOPT_NAMESPACE */ - if(np=nv_search(name,troot,0)) { - if(!is_afunction(np)) - np = 0; + if(np=nv_search(name,troot,0)) + { + if(!is_afunction(np)) + np = 0; + } + else if(memcmp(name,".sh.math.",9)==0 && sh_mathstd(name+9)) + continue; } - else if(memcmp(name,".sh.math.",9)==0 && sh_mathstd(name+9)) - continue; } if(np && ((flag&NV_LTOU) || !nv_isnull(np) || nv_isattr(np,NV_LTOU))) { @@ -1090,12 +1092,9 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context) struct tdata tdata; Shbltin_f addr; Stk_t *stkp; - void *library=0; char *errmsg; #if SHOPT_DYNAMIC - unsigned long ver; int list = 0; - char path[1024]; #endif NOT_USED(argc); memset(&tdata,0,sizeof(tdata)); @@ -1156,6 +1155,9 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context) #if SHOPT_DYNAMIC if(arg) { + unsigned long ver; + char path[PATH_MAX]; + void *library; if(!(library = dllplugin(SH_ID, arg, NiL, SH_PLUGIN_VERSION, &ver, RTLD_LAZY, path, sizeof(path)))) { errormsg(SH_DICT,ERROR_exit(0),"%s: %s",arg,dllerror(0)); @@ -1354,8 +1356,8 @@ static int unall(int argc, char **argv, register Dt_t *troot) isfun = is_afunction(np); if(troot==sh.var_tree) { - Namarr_t *ap; #if SHOPT_FIXEDARRAY + Namarr_t *ap; if((ap=nv_arrayptr(np)) && !ap->fixed && name[strlen(name)-1]==']' && !nv_getsub(np)) #else if(nv_isarray(np) && name[strlen(name)-1]==']' && !nv_getsub(np)) diff --git a/src/cmd/ksh93/data/msg.c b/src/cmd/ksh93/data/msg.c index bae4f9b2a..9c6bf731e 100644 --- a/src/cmd/ksh93/data/msg.c +++ b/src/cmd/ksh93/data/msg.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -70,7 +70,7 @@ const char e_restricted[] = "%s: restricted"; #if SHOPT_PFSH const char e_pfsh[] = "%s: disabled in profile shell"; #endif -const char e_pexists[] = "process already exists"; +const char e_copexists[] = "coprocess is running; cannot create a new coprocess"; const char e_exists[] = "%s: file already exists"; const char e_pipe[] = "cannot create pipe"; const char e_alarm[] = "cannot set alarm"; diff --git a/src/cmd/ksh93/edit/vi.c b/src/cmd/ksh93/edit/vi.c index 633ae2f31..bd8b34506 100644 --- a/src/cmd/ksh93/edit/vi.c +++ b/src/cmd/ksh93/edit/vi.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -2737,10 +2737,12 @@ yankeol: #if SHOPT_MULTIBYTE if((c&~STRIP)==0) #endif /* SHOPT_MULTIBYTE */ - if( isupper(c) ) - c = tolower(c); - else if( islower(c) ) - c = toupper(c); + { + if( isupper(c) ) + c = tolower(c); + else if( islower(c) ) + c = toupper(c); + } replace(vp,c, 1); } return(GOOD); diff --git a/src/cmd/ksh93/include/io.h b/src/cmd/ksh93/include/io.h index cb5cb1e8a..dadb1205f 100644 --- a/src/cmd/ksh93/include/io.h +++ b/src/cmd/ksh93/include/io.h @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -76,7 +76,7 @@ extern int sh_devtofd(const char*); extern int sh_isdevfd(const char*); /* the following are readonly */ -extern const char e_pexists[]; +extern const char e_copexists[]; extern const char e_query[]; extern const char e_history[]; extern const char e_argtype[]; diff --git a/src/cmd/ksh93/include/ulimit.h b/src/cmd/ksh93/include/ulimit.h index cbef19c4c..fc891b405 100644 --- a/src/cmd/ksh93/include/ulimit.h +++ b/src/cmd/ksh93/include/ulimit.h @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -29,7 +29,7 @@ #if defined(_sys_resource) && defined(_lib_getrlimit) # include # if !defined(RLIMIT_FSIZE) && defined(_sys_vlimit) - /* This handles hp/ux problem */ + /* This handles HP-UX problem */ # include # define RLIMIT_FSIZE (LIM_FSIZE-1) # define RLIMIT_DATA (LIM_DATA-1) diff --git a/src/cmd/ksh93/sh/macro.c b/src/cmd/ksh93/sh/macro.c index ffc2a9a68..3f04e415b 100644 --- a/src/cmd/ksh93/sh/macro.c +++ b/src/cmd/ksh93/sh/macro.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -2268,10 +2268,8 @@ static void comsubst(Mac_t *mp,register Shnode_t* t, int type) str[c] = 0; else { - ssize_t len = 1; - /* can't write past buffer so save last character */ - c -= len; + c -= 1; lastc = str[c]; str[c] = 0; } diff --git a/src/cmd/ksh93/sh/nvtree.c b/src/cmd/ksh93/sh/nvtree.c index 2e2ae1495..dbec1557a 100644 --- a/src/cmd/ksh93/sh/nvtree.c +++ b/src/cmd/ksh93/sh/nvtree.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -744,7 +744,9 @@ static void outval(char *name, const char *vname, struct Walk *wp) { if(*name!='.') { +#if SHOPT_FIXEDARRAY Namarr_t *ap; +#endif nv_attribute(np,wp->out,"typeset",'='); #if SHOPT_FIXEDARRAY if((ap=nv_arrayptr(np)) && ap->fixed) diff --git a/src/cmd/ksh93/sh/nvtype.c b/src/cmd/ksh93/sh/nvtype.c index 5cc290a8f..e6cbf1d15 100644 --- a/src/cmd/ksh93/sh/nvtype.c +++ b/src/cmd/ksh93/sh/nvtype.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -430,11 +430,11 @@ static Namfun_t *clone_type(Namval_t* np, Namval_t *mp, int flags, Namfun_t *fp) nv_putsub(nq,cp,ARRAY_ADD|ARRAY_NOSCOPE); if(array_assoc(ap)) { - Namval_t *mp = (Namval_t*)((*ap->fun)(nr,NIL(char*),NV_ACURRENT)); + Namval_t *mr = (Namval_t*)((*ap->fun)(nr,NIL(char*),NV_ACURRENT)); Namval_t *mq = (Namval_t*)((*ap->fun)(nq,NIL(char*),NV_ACURRENT)); - nv_clone(mp,mq,NV_MOVE); + nv_clone(mr,mq,NV_MOVE); ap->nelem--; - nv_delete(mp,ap->table,0); + nv_delete(mr,ap->table,0); } else { diff --git a/src/cmd/ksh93/sh/path.c b/src/cmd/ksh93/sh/path.c index 9df05bf13..ab0a802c6 100644 --- a/src/cmd/ksh93/sh/path.c +++ b/src/cmd/ksh93/sh/path.c @@ -770,7 +770,9 @@ Pathcomp_t *path_absolute(register const char *name, Pathcomp_t *pp, int flag) Pathcomp_t *oldpp; Namval_t *np; char *cp; +#if SHOPT_DYNAMIC char *bp; +#endif sh.path_err = ENOENT; if(!pp && !(pp=path_get(Empty))) return(0); @@ -885,7 +887,10 @@ Pathcomp_t *path_absolute(register const char *name, Pathcomp_t *pp, int flag) { *cp = 0; if(nv_open(name,sh_subfuntree(1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE)) + { + sh_close(f); f = -1; + } *cp = '.'; } if(isfun && f>=0) @@ -895,7 +900,7 @@ Pathcomp_t *path_absolute(register const char *name, Pathcomp_t *pp, int flag) nv_onattr(nv_open(name,sh_subfuntree(1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE),NV_LTOU|NV_FUNCTION); funload(f,name); } - close(f); + sh_close(f); return(0); } else if(f>=0 && (oldpp->flags & PATH_STD_DIR)) diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index a56840840..cc7712728 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -3401,7 +3401,7 @@ static void coproc_init(int pipes[]) int outfd; if(sh.coutpipe>=0 && sh.cpid) { - errormsg(SH_DICT,ERROR_exit(1),e_pexists); + errormsg(SH_DICT,ERROR_exit(1),e_copexists); UNREACHABLE(); } sh.cpid = 0; diff --git a/src/cmd/ksh93/tests/bracket.sh b/src/cmd/ksh93/tests/bracket.sh index 785ea9756..8e6faf611 100755 --- a/src/cmd/ksh93/tests/bracket.sh +++ b/src/cmd/ksh93/tests/bracket.sh @@ -2,7 +2,7 @@ # # # This software is part of the ast package # # Copyright (c) 1982-2012 AT&T Intellectual Property # -# Copyright (c) 2020-2021 Contributors to ksh 93u+m # +# Copyright (c) 2020-2022 Contributors to ksh 93u+m # # and is licensed under the # # Eclipse Public License, Version 1.0 # # by AT&T Intellectual Property # @@ -239,9 +239,9 @@ if rm -rf "$file" && ln -s / "$file" then [[ -L "$file" ]] || err_exit '-L not working' [[ -L "$file"/ ]] && err_exit '-L with file/ not working' fi -$SHELL -c 't=1234567890; [[ $t == @({10}(\d)) ]]' 2> /dev/null || err_exit ' @({10}(\d)) pattern not working' -$SHELL -c '[[ att_ == ~(E)(att|cus)_.* ]]' 2> /dev/null || err_exit ' ~(E)(att|cus)_* pattern not working' -$SHELL -c '[[ att_ =~ (att|cus)_.* ]]' 2> /dev/null || err_exit ' =~ ere not working' +$SHELL -c 't=1234567890; [[ $t == @({10}(\d)) ]]' 2> /dev/null || err_exit '@({10}(\d)) pattern not working' +$SHELL -c '[[ att_ == ~(E)(att|cus)_.* ]]' 2> /dev/null || err_exit '~(E)(att|cus)_* pattern not working' +$SHELL -c '[[ att_ =~ (att|cus)_.* ]]' 2> /dev/null || err_exit '=~ ere not working' $SHELL -c '[[ abc =~ a(b)c ]]' 2> /dev/null || err_exit '[[ abc =~ a(b)c ]] fails' $SHELL -xc '[[ abc =~ \babc\b ]]' 2> /dev/null || err_exit '[[ abc =~ \babc\b ]] fails' [[ abc == ~(E)\babc\b ]] || err_exit '\b not preserved for ere when not in ()' diff --git a/src/cmd/ksh93/tests/builtins.sh b/src/cmd/ksh93/tests/builtins.sh index 78a9b4a47..175b91ddb 100755 --- a/src/cmd/ksh93/tests/builtins.sh +++ b/src/cmd/ksh93/tests/builtins.sh @@ -1454,6 +1454,14 @@ if builtin rm 2> /dev/null; then [[ $? == 0 ]] || err_exit 'rm builtin fails to remove non-empty directory and file with -rd options' \ "(got $(printf %q "$got"))" [[ -f $tmp/nonemptydir2/shouldexist || -d $tmp/nonemptydir2 ]] && err_exit 'rm builtin fails to remove all folders and files with -rd options' + + # Additional test: 'rm -f' without additional arguments should act + # as a no-op command. This bug was fixed in ksh93u+ 2012-02-14. + got=$(rm -f 2>&1) + if (($? != 0)) || [[ ! -z $got ]] + then err_exit 'rm -f without additional arguments does not work correctly' \ + "(got $(printf %q "$got"))" + fi fi # ====== diff --git a/src/lib/libast/cdt/dtdisc.c b/src/lib/libast/cdt/dtdisc.c index da0e5cf8c..8917fd432 100644 --- a/src/lib/libast/cdt/dtdisc.c +++ b/src/lib/libast/cdt/dtdisc.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -34,6 +34,8 @@ static void* dtmemory(Dt_t* dt, /* dictionary */ size_t size, /* size to obtain */ Dtdisc_t* disc) /* discipline */ { + NOT_USED(dt); + NOT_USED(disc); if(addr) { if(size == 0) { free(addr); diff --git a/src/lib/libast/man/spawnveg.3 b/src/lib/libast/man/spawnveg.3 index 960614b82..7778d82ba 100644 --- a/src/lib/libast/man/spawnveg.3 +++ b/src/lib/libast/man/spawnveg.3 @@ -94,4 +94,4 @@ cannot make the new process a session leader when using the .I posix_spawn API. .SH "SEE ALSO" -fork(2), posix_spawn(3), exec(2), setpgid(2), setsid(2), spawnve(2) +fork(2), vfork(2), posix_spawn(3), exec(2), setpgid(2), setsid(2), spawnve(2) diff --git a/src/lib/libast/misc/optget.c b/src/lib/libast/misc/optget.c index 0bf9720fd..c0ba75b36 100644 --- a/src/lib/libast/misc/optget.c +++ b/src/lib/libast/misc/optget.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -1111,6 +1111,7 @@ init(register char* s, Optpass_t* p) } s = next(s, 0); if (*s != '[') + { for (t = s, a = 0; *t; t++) if (!a && *t == '-') { @@ -1121,6 +1122,7 @@ init(register char* s, Optpass_t* p) a++; else if (*t == ']') a--; + } if (!p->version && (t = strchr(s, '(')) && strchr(t, ')') && (state.cp || (state.cp = sfstropen()))) { /* diff --git a/src/lib/libast/port/astconf.c b/src/lib/libast/port/astconf.c index 99b5f2f4a..7d2b128a2 100644 --- a/src/lib/libast/port/astconf.c +++ b/src/lib/libast/port/astconf.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -1351,10 +1351,10 @@ print(Sfio_t* sp, register Lookup_t* look, const char* name, const char* path, i * return read stream to native getconf utility */ +#ifdef _pth_getconf_a static Sfio_t* nativeconf(Proc_t** pp, const char* operand) { -#ifdef _pth_getconf Sfio_t* sp; char* cmd[3]; long ops[2]; @@ -1376,9 +1376,9 @@ nativeconf(Proc_t** pp, const char* operand) } procclose(*pp); } -#endif return 0; } +#endif /* * value==0 gets value for name diff --git a/src/lib/libast/sfio/sfmode.c b/src/lib/libast/sfio/sfmode.c index 4ceb5a283..9f61c0085 100644 --- a/src/lib/libast/sfio/sfmode.c +++ b/src/lib/libast/sfio/sfmode.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -59,7 +59,9 @@ static char* Version = "\n@(#)$Id: sfio (AT&T Labs - Research) 2009-09-15 $\0\n" #include typedef void(* Sfsignal_f)(int); #endif +#ifdef SIGPIPE static int _Sfsigp = 0; /* # of streams needing SIGPIPE protection */ +#endif /* done at exiting time */ static void _sfcleanup(void) diff --git a/src/lib/libast/sfio/sfpopen.c b/src/lib/libast/sfio/sfpopen.c index b074b333a..9a2fd86be 100644 --- a/src/lib/libast/sfio/sfpopen.c +++ b/src/lib/libast/sfio/sfpopen.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -62,9 +62,8 @@ static void execute(const char* argcmd) goto do_interp; /* try to construct argv */ - if(!(cmd = (char*)malloc(strlen(argcmd)+1)) ) + if(!(cmd = strdup(argcmd)) ) goto do_interp; - strcpy(cmd,argcmd); if(!(argv = (char**)malloc(16*sizeof(char*))) ) goto do_interp; for(n = 0, s = cmd;; ) diff --git a/src/lib/libast/sfio/sftmp.c b/src/lib/libast/sfio/sftmp.c index 9b0efabd5..f0c9ceefb 100644 --- a/src/lib/libast/sfio/sftmp.c +++ b/src/lib/libast/sfio/sftmp.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -159,11 +159,10 @@ char** _sfgetpath(char* path) } if(n == 0 || !(dirs = (char**)malloc((n+1)*sizeof(char*))) ) return NIL(char**); - if(!(p = (char*)malloc(strlen(path)+1)) ) + if(!(p = strdup(path)) ) { free(dirs); return NIL(char**); } - strcpy(p,path); for(n = 0;; ++n) { while(*p == ':') ++p; @@ -218,12 +217,11 @@ static int _tmpfd(Sfio_t* f) return -1; if(!(file = getenv("TMPDIR")) ) file = TMPDFLT; - if(!(Tmppath[0] = (char*)malloc(strlen(file)+1)) ) + if(!(Tmppath[0] = strdup(file)) ) { free(Tmppath); Tmppath = NIL(char**); return -1; } - strcpy(Tmppath[0],file); Tmppath[1] = NIL(char*); } diff --git a/src/lib/libast/tm/tmxfmt.c b/src/lib/libast/tm/tmxfmt.c index 5ed3e4b69..ef1bba746 100644 --- a/src/lib/libast/tm/tmxfmt.c +++ b/src/lib/libast/tm/tmxfmt.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * +* Copyright (c) 2020-2022 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 1.0 * * by AT&T Intellectual Property * @@ -137,7 +137,6 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) { if ((c = *format++) == delimiter) { - delimiter = 0; if (sp <= &stack[0]) break; sp--; diff --git a/src/lib/libast/tm/tmxscan.c b/src/lib/libast/tm/tmxscan.c index 97f7433f7..30d93fcec 100644 --- a/src/lib/libast/tm/tmxscan.c +++ b/src/lib/libast/tm/tmxscan.c @@ -173,7 +173,6 @@ scan(register const char* s, char** e, const char* format, char** f, Time_t t, l register char* p; register Tm_t* tm; const char* b; - char* u; char* stack[4]; int m; int hi; @@ -184,6 +183,7 @@ scan(register const char* s, char** e, const char* format, char** f, Time_t t, l Tm_zone_t* zp; Tm_t ts; + char* u = 0; char** sp = &stack[0]; while (isspace(*s)) @@ -397,7 +397,7 @@ scan(register const char* s, char** e, const char* format, char** f, Time_t t, l s = b; goto again; case '&': - x = gen(tm, &set); + (void)gen(tm, &set); x = tmxdate(s, e, t); if (s == (const char*)*e) goto next;