diff options
author | Denis Vlasenko | 2007-05-03 22:57:56 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-05-03 22:57:56 +0000 |
commit | f71d916b60079f2009a714e49cb3e83efedbfb77 (patch) | |
tree | 435d8f5bbcfc025142a735056335638efe0db0b4 | |
parent | e725bfe6e01505f0480dd1bd357209d3a2e72bb7 (diff) | |
download | busybox-f71d916b60079f2009a714e49cb3e83efedbfb77.zip busybox-f71d916b60079f2009a714e49cb3e83efedbfb77.tar.gz |
awk: guard against empty environment
-rw-r--r-- | editors/awk.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/editors/awk.c b/editors/awk.c index 5a504d0..bc9e99a 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -2696,7 +2696,8 @@ int awk_main(int argc, char **argv) newfile("/dev/stdout")->F = stdout; newfile("/dev/stderr")->F = stderr; - for (envp = environ; *envp; envp++) { + /* Huh, people report that sometimes environ is NULL. Oh well. */ + if (environ) for (envp = environ; *envp; envp++) { char *s = xstrdup(*envp); char *s1 = strchr(s, '='); if (s1) { |