140 |
|
|
141 |
if(fstat(i, &st) == -1 && open("/dev/null", O_RDWR) != i) { |
if(fstat(i, &st) == -1 && open("/dev/null", O_RDWR) != i) { |
142 |
|
|
143 |
error("Cannot open /dev/null -- %s\n", STRERROR); |
log("Cannot open /dev/null -- %s\n", STRERROR); |
144 |
exit(1); |
exit(1); |
145 |
|
|
146 |
} |
} |
168 |
|
|
169 |
if(putenv(path)) { |
if(putenv(path)) { |
170 |
|
|
171 |
error("%s: cannot set the PATH variable -- %s\n", prog, STRERROR); |
log("%s: cannot set the PATH variable -- %s\n", prog, STRERROR); |
172 |
exit(1); |
exit(1); |
173 |
|
|
174 |
} |
} |
187 |
/* Get password struct */ |
/* Get password struct */ |
188 |
if ( ! (pw= getpwuid(geteuid())) ) { |
if ( ! (pw= getpwuid(geteuid())) ) { |
189 |
|
|
190 |
error("%s: You don't exist. Go away.\n", prog); |
log("%s: You don't exist. Go away.\n", prog); |
191 |
exit(1); |
exit(1); |
192 |
|
|
193 |
} |
} |
195 |
/* Get CWD */ |
/* Get CWD */ |
196 |
if ( ! (getcwd(cwd, sizeof(cwd))) ) { |
if ( ! (getcwd(cwd, sizeof(cwd))) ) { |
197 |
|
|
198 |
error("%s: Cannot read current directory -- %s\n", prog, STRERROR); |
log("%s: Cannot read current directory -- %s\n", prog, STRERROR); |
199 |
exit(1); |
exit(1); |
200 |
|
|
201 |
} |
} |