comparison toys/lsb/su.c @ 1248:407357afa07f draft

Bugfix: if $TERM and friends aren't set, putenv() got passed a NULL.
author Rob Landley <rob@landley.net>
date Wed, 09 Apr 2014 09:23:17 -0500
parents 0752b2d58909
children 685a0da6ca59
comparison
equal deleted inserted replaced
1247:d630b3be752f 1248:407357afa07f
69 int i; 69 int i;
70 char *stuff[] = {snapshot_env("TERM"), snapshot_env("DISPLAY"), 70 char *stuff[] = {snapshot_env("TERM"), snapshot_env("DISPLAY"),
71 snapshot_env("COLORTERM"), snapshot_env("XAUTHORITY")}; 71 snapshot_env("COLORTERM"), snapshot_env("XAUTHORITY")};
72 72
73 clearenv(); 73 clearenv();
74 for (i=0; i < sizeof(stuff)/sizeof(char *); i++) putenv(stuff[i]); 74 for (i=0; i < ARRAY_LEN(stuff); i++) if (stuff[i]) putenv(stuff[i]);
75 *(argv++) = "-l"; 75 *(argv++) = "-l";
76 xchdir(up->pw_dir); 76 xchdir(up->pw_dir);
77 } else unsetenv("IFS"); 77 } else unsetenv("IFS");
78 setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1); 78 setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1);
79 if (!(toys.optflags & (FLAG_m|FLAG_p))) { 79 if (!(toys.optflags & (FLAG_m|FLAG_p))) {