awk: guard against empty environment
This commit is contained in:
@@ -2696,7 +2696,8 @@ int awk_main(int argc, char **argv)
|
|||||||
newfile("/dev/stdout")->F = stdout;
|
newfile("/dev/stdout")->F = stdout;
|
||||||
newfile("/dev/stderr")->F = stderr;
|
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 *s = xstrdup(*envp);
|
||||||
char *s1 = strchr(s, '=');
|
char *s1 = strchr(s, '=');
|
||||||
if (s1) {
|
if (s1) {
|
||||||
|
Reference in New Issue
Block a user