summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {