← Commit list

f71d916b6

Denis Vlasenko
Denis Vlasenko
2007-05-03
FAILED Duration: 12s

Subject

awk: guard against empty environment

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

editors/awk.c+2 -1
@@ -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) {