1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd/ksh93/data
Martijn Dekker 18529b88c6 Add lots of checks for out of memory (re: 0ce0b671)
Huge typeset -L/-R adjustment length values were still causing
crashses on sytems with not enough memory. They should error out
gracefully instead of crashing.

This commit adds out of memory checks to all malloc/calloc/realloc
calls that didn't have them (which is all but two or three).

The stkalloc/stakalloc calls don't need the checks; it has
automatic checking, which is done by passing a pointer to the
outofspace() function to the stakinstall() call in init.c.

src/lib/libast/include/error.h:
- Change the ERROR_PANIC exit status value from ERROR_LEVEL (255)
  to 77, which is what it is supposed to be according to the libast
  error.3 manual page. Exit statuses > 128 for anything else than
  signals are not POSIX compliant and may cause misbehaviour.

src/cmd/ksh93/include/defs.h,
src/cmd/ksh93/sh/init.c:
- To facilitate consistency, add a simple extern sh_outofmemory()
  function that throws an ERROR_PANIC "out of memory".

src/cmd/ksh93/include/shell.h,
src/cmd/ksh93/data/builtins.c:
- Remove now-redundant e_nospace[] extern message; it is now only
  used in one place so it might as well be a string literal in
  sh_outofmemory().

All other changed files:
- Verify the result of all malloc/calloc/realloc calls and call
  sh_outofmemory() if they fail.
2021-02-21 22:27:28 +00:00
..
aliases.c Reinstate 'r' and 'history' as preset aliases for interactive ksh 2020-09-11 21:35:45 +02:00
builtins.c Add lots of checks for out of memory (re: 0ce0b671) 2021-02-21 22:27:28 +00:00
keywords.c Fix many spelling errors and word repetitions (#188) 2021-02-20 03:22:24 +00:00
lexstates.c Fix compile/regress fails on compiling without SHOPT_* options 2021-02-08 22:02:45 +00:00
limits.c Fix 80 typos in comments 2020-06-12 01:45:12 +02:00
math.tab Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
msg.c Fix bugs related to --posix shell option (re: 921bbcae, f45a0f16) 2021-02-14 23:51:19 +00:00
options.c Fix many spelling errors and word repetitions (#188) 2021-02-20 03:22:24 +00:00
signals.c data/signals.c: fix empty SIGINT/SIGPIPE messages 2020-09-18 03:22:26 +02:00
strdata.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
testops.c resolve/remove USAGE_LICENSE macros; remove repetitive (c) strings 2021-01-31 11:00:49 +00:00
variables.c Fix compile/regress fails on compiling without SHOPT_* options 2021-02-08 22:02:45 +00:00