summaryrefslogtreecommitdiffstats
path: root/bin/ksh/exec.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-5/+5
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* Favor usage of __func__ in warning/error messages. Some of them referred to theanton2018-03-151-4/+4
| | | | | | | wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied. ok benno@ tb@
* Introduce internal_warningf() and mark internal_errorf() as noreturnjca2018-01-161-5/+5
| | | | | This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@
* Stop pretending we support building ksh without EDIT/HISTORY supportjca2018-01-151-3/+1
| | | | ok anton@
* Add -Wshadow to Makefile and fix the resulting warnings. Many ofmillert2017-12-271-4/+4
| | | | | | | the warnings are due to the use of globals with generic names, specifically "options" and "path". I've renamed "options" to "sh_options" since it holds the shell options and "path" to "search_path". OK jca@ tb@
* Get rid of a todo by stop declaring variable texec as static and instead zeroinganton2017-12-181-2/+3
| | | | | | it out prior to continuing down the recursive call chain. Initial diff from Michael W. Bombardieri, later tweaked; ok tb@
* I missed a bit of the indentation fix from Kartik Agaram.millert2016-12-111-4/+4
|
* When ERREXIT (set -e) is in effect, don't disable it after amillert2016-12-111-3/+11
| | | | | | | short-circuited `&&` or `||` chain in later iterations of `for` loops. It should be disabled after a short-circuited `&&` or `||` chain only in the *final* iteration of loops (as well as in conditionals, which was already working). From Kartik Agaram.
* In execute() we assign xerrorok to a dummy value if it is NULLmillert2016-12-111-7/+4
| | | | | so there is no need to check xerrorok for NULL after that. From Kartik Agaram.
* Fix for() loop indentation for TCASE in execute() and add somemillert2016-12-111-6/+8
| | | | braces for improved readability. Based on a diff from Kartik Agaram.
* rename global "e" to genv to avoid accidental shadowing and aliasing.tedu2015-12-301-31/+31
| | | | ok millert nicm tb
* Move system headers from sh.h to those files that actually need them.tb2015-12-141-1/+6
| | | | ok mmcc@ a while ago
* Add uses of areallocarray(). mksh and Bitrig ksh already have similarmmcc2015-11-011-3/+3
| | | | | | functions. With help from Theo Buehler. ok nicm@
* Move string.h include from sh.h to the files that use it.mmcc2015-10-191-1/+2
| | | | ok nicm@
* Apply style(9) to header includes.mmcc2015-10-191-4/+6
| | | | ok nicm@
* Drop two useless defines.mmcc2015-10-171-3/+3
| | | | ok nicm@
* Move a system header include from the global header (sh.h) into themmcc2015-10-171-1/+2
| | | | | | files that need it. No binary change. "This looks fine" -nicm@
* Make errorf() and bi_errorf() handle a NULL argument.millert2015-09-221-2/+2
| | | | From Michael McConville; OK nicm@
* Last of the (thing *)0 -> NULL, from Michael McConville. No binarynicm2015-09-181-8/+8
| | | | change.
* Remove unnecessary casts, from Michael McConville. No binary change.nicm2015-09-171-2/+2
|
* correct spelling of NULL from (char *)0. from Michael McConville.tedu2015-09-151-12/+12
| | | | ok md5
* Replace Tflag typedef with just int; ok tedunicm2015-09-141-4/+3
|
* Replace newline and space defines by "\n" and " " directly, from Michaelnicm2015-09-101-3/+3
| | | | McConville. ok millert
* Convert many atoi() calls to strtonum(), adding range checks and failurederaadt2015-04-181-3/+6
| | | | | handling along the way. Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert
* POSIX specifies that for an AND/OR list, only the last command'smillert2013-06-101-5/+7
| | | | | | exit status matters for "set -e". Revert the part of revision 1.49 that always sets xerrok for AND/OR. This makes sh/ksh pass the updated regress tests. OK espie@ jca@
* pass "xerrok" status across the execution call stack to more closelyjaredy2009-01-291-33/+43
| | | | | | | | | | | | | | | | match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values. specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect. issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
* Call ERR trap _before_ doing exit handling. Otherwise it's too lateotto2007-09-051-2/+2
| | | | and the ERR trap won't get called at all. ok millert@
* another memory leak fix found by coverity. from netbsd but modified.fgsch2007-08-021-2/+8
| | | | millert@ ok.
* fix lint comments, no functional changes; ok rayjaredy2006-04-101-3/+3
|
* Simplify savefd() by removing the "noclose" flag and make noclosemillert2006-03-171-7/+6
| | | | | behavior the default. Almost all uses of savefd() are followed by an implicit or explicit close. OK otto@
* fix a few name clashes with libc; found by lint. ok deraadt@otto2005-12-111-10/+10
|
* remove unused variables and functionsderaadt2005-12-111-2/+2
|
* Fix " handling in here documents. POSIX says they are not special, sootto2005-09-111-2/+2
| | | | | | | | cat << EOF \" EOF should print \" Fixes PR 4472; testing jmc@ and Adam Montague. ok millert@
* lots of indentation cleanup, now ksh is readable like our other code.deraadt2005-03-301-124/+116
| | | | double checked to make sure no binaries change, and eyed by niallo
* spacingderaadt2005-03-281-6/+3
|
* Fix a use-after-free, that causs core dumps if a shell is killedotto2004-12-221-10/+9
| | | | | | | running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@. ok millert@ hshoexer@ krw@ deraadt@
* Use stdbool.h instead of rolling our own bools.millert2004-12-221-35/+35
|
* Ansification plus some minor knf. No binary change on i386 andotto2004-12-201-94/+44
| | | | | sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
* spacingderaadt2004-12-191-3/+3
|
* Replace fd_clexec() with calls to fcntl(fd, F_SETFD, FD_CLOEXEC)millert2004-12-181-12/+1
|
* deregistermillert2004-12-181-12/+12
|
* Get rid of #ifdef KSH since we don't care about building a V7 style sh andmillert2004-12-181-29/+4
| | | | the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian
* Remove unused OS dependent #ifdef blocks, #defines and macro abstraction.millert2004-12-181-257/+34
| | | | First step in making the ksh code easier to read. From Matthias Kilian
* Unbreak parameter assignment when calling bourne style functions;otto2003-12-151-3/+7
| | | | | | resolves PR 2450. ok deraadt@ millert@
* If "from fd" == "to fd" don't call dup2() or close "from fd".millert2003-11-101-3/+5
|
* For the >& and <& operators, add a check for "dup from" == "dup to" andmillert2003-11-101-1/+3
| | | | | just return success if they are the same. Fixes the "ls 2>&2" problem miod@ found.
* typos from Jared Yanovich;jmc2003-10-221-2/+2
| | | | ok deraadt@
* typos; from Brian Poolejmc2003-02-281-2/+2
|
* knftodd2002-06-091-5/+5
|
* Use the volatile specifier to fix warnings about variables beingmillert2002-01-161-6/+2
| | | | clobbered by longjmp / vfork instead of the gcc "(void)&foo;" hack.