| 198 |
|
if (ps->username[0]) { /* different user */ |
| 199 |
|
av[++i] = "-l"; |
| 200 |
|
av[++i] = ps->username; |
| 201 |
< |
av[++i] = "cd"; |
| 202 |
< |
udirt[0] = '~'; |
| 203 |
< |
strcpy(udirt+1, ouruser); |
| 204 |
< |
av[++i] = udirt; |
| 205 |
< |
av[++i] = ";"; |
| 201 |
> |
if (ps->directory[0] != '/') { |
| 202 |
> |
av[++i] = "cd"; |
| 203 |
> |
udirt[0] = '~'; |
| 204 |
> |
strcpy(udirt+1, ouruser); |
| 205 |
> |
av[++i] = udirt; |
| 206 |
> |
av[++i] = ";"; |
| 207 |
> |
} |
| 208 |
|
} |
| 209 |
|
if (ps->directory[0]) { /* change directory */ |
| 210 |
|
av[++i] = "cd"; |
| 231 |
|
ps->proc[i].pid = pid; |
| 232 |
|
close(pfd[1]); /* get piped stderr file descriptor */ |
| 233 |
|
ps->proc[i].efd = pfd[0]; |
| 234 |
< |
fcntl(pfd[0], F_SETFD, 1); /* set close on exec flag */ |
| 234 |
> |
fcntl(pfd[0], F_SETFD, FD_CLOEXEC); /* set close on exec flag */ |
| 235 |
|
pindex[pfd[0]] = ps->proc + i; /* assign error fd index */ |
| 236 |
|
FD_SET(pfd[0], &errdesc); /* add to select call parameter */ |
| 237 |
|
if (pfd[0] > maxfd) |