diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-05-03 22:57:56 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-05-03 22:57:56 +0000 |
commit | 32b8e14f2da4407a443bb8e6d261cb711c8559cc (patch) | |
tree | 435d8f5bbcfc025142a735056335638efe0db0b4 | |
parent | ec78fbb5f97ee0f114438d8f6df96b18e9db5ee5 (diff) | |
download | busybox-w32-32b8e14f2da4407a443bb8e6d261cb711c8559cc.tar.gz busybox-w32-32b8e14f2da4407a443bb8e6d261cb711c8559cc.tar.bz2 busybox-w32-32b8e14f2da4407a443bb8e6d261cb711c8559cc.zip |
awk: guard against empty environment
git-svn-id: svn://busybox.net/trunk/busybox@18552 69ca8d6d-28ef-0310-b511-8ec308f3f277
-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 5a504d034..bc9e99a6f 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -2696,7 +2696,8 @@ int awk_main(int argc, char **argv) | |||
2696 | newfile("/dev/stdout")->F = stdout; | 2696 | newfile("/dev/stdout")->F = stdout; |
2697 | newfile("/dev/stderr")->F = stderr; | 2697 | newfile("/dev/stderr")->F = stderr; |
2698 | 2698 | ||
2699 | for (envp = environ; *envp; envp++) { | 2699 | /* Huh, people report that sometimes environ is NULL. Oh well. */ |
2700 | if (environ) for (envp = environ; *envp; envp++) { | ||
2700 | char *s = xstrdup(*envp); | 2701 | char *s = xstrdup(*envp); |
2701 | char *s1 = strchr(s, '='); | 2702 | char *s1 = strchr(s, '='); |
2702 | if (s1) { | 2703 | if (s1) { |