summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenis Vlasenko2007-05-03 22:57:56 +0000
committerDenis Vlasenko2007-05-03 22:57:56 +0000
commitf71d916b60079f2009a714e49cb3e83efedbfb77 (patch)
tree435d8f5bbcfc025142a735056335638efe0db0b4 /editors
parente725bfe6e01505f0480dd1bd357209d3a2e72bb7 (diff)
downloadbusybox-f71d916b60079f2009a714e49cb3e83efedbfb77.zip
busybox-f71d916b60079f2009a714e49cb3e83efedbfb77.tar.gz
awk: guard against empty environment
Diffstat (limited to 'editors')
-rw-r--r--editors/awk.c3
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) {