diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-08-22 21:38:44 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-08-22 21:38:44 +0300 |
commit | 7622c96e99921f28c032b742f169d9558df89355 (patch) | |
tree | c24eef8947af60de3b4237cecbfb3aa9cbd22244 | |
parent | 445f13a1e5eff0b0f520118fd89db7fe0a7b0aa8 (diff) | |
download | egawk-7622c96e99921f28c032b742f169d9558df89355.tar.gz egawk-7622c96e99921f28c032b742f169d9558df89355.tar.bz2 egawk-7622c96e99921f28c032b742f169d9558df89355.zip |
Bug fix for Mac OS X in passing environment through.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | str_array.c | 7 |
2 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,9 @@ +2013-08-22 Arnold D. Robbins <arnold@skeeve.com> + + * str_array.c (env_store): If the new value being stored is NULL, + pass in "" instead. Avoids core dump on Mac OS X. + Thanks to Hermann Peifer for the bug report. + 2013-08-20 Arnold D. Robbins <arnold@skeeve.com> * nonposix.h: New file. Contains FAKE_FD_VALUE. diff --git a/str_array.c b/str_array.c index e4352a9f..33c9ddcc 100644 --- a/str_array.c +++ b/str_array.c @@ -792,10 +792,15 @@ static NODE ** env_store(NODE *symbol, NODE *subs) { NODE **val = str_exists(symbol, subs); + const char *newval; assert(val != NULL); - (void) setenv(subs->stptr, (*val)->stptr, 1); + newval = (*val)->stptr; + if (newval == NULL) + newval = ""; + + (void) setenv(subs->stptr, newval, 1); return val; } |