Lines 977-982
Link Here
|
977 |
int displayarg = -1; |
977 |
int displayarg = -1; |
978 |
char **clientargs = cmdargs; |
978 |
char **clientargs = cmdargs; |
979 |
char **serverargs = NULL; |
979 |
char **serverargs = NULL; |
|
|
980 |
char *clientbin; |
980 |
|
981 |
|
981 |
/* Parse arguments into client and server options. We are not |
982 |
/* Parse arguments into client and server options. We are not |
982 |
using argv[0] but otoh need room for NULL */ |
983 |
using argv[0] but otoh need room for NULL */ |
Lines 1045-1055
Link Here
|
1045 |
|
1046 |
|
1046 |
set_default_environment(); |
1047 |
set_default_environment(); |
1047 |
|
1048 |
|
1048 |
/* Launch first client */ |
1049 |
/* Launch first client. Simulate exec -l: |
1049 |
pid_t client = subprocess(clientargs, set_client_process, NULL, NULL); |
1050 |
"If the -l option is supplied, the shell places a dash at the |
|
|
1051 |
beginning of the zeroth argument passed to command. This is |
1052 |
what login(1) does." |
1053 |
*/ |
1054 |
clientbin = clientargs[0]; |
1055 |
clientargs[0] = malloc(strlen(clientbin) + 2); /* Space for dash and trailing zero */ |
1056 |
strcpy(clientargs[0], "-"); |
1057 |
strcat(clientargs[0], clientbin); |
1058 |
pid_t client = subprocess_file(clientbin, clientargs, set_client_process, NULL, NULL); |
1050 |
if (client < 0) { |
1059 |
if (client < 0) { |
1051 |
fprintf(stderr, PROGNAME ": Failed to execute client\n"); |
1060 |
fprintf(stderr, PROGNAME ": Failed to execute client\n"); |
1052 |
} |
1061 |
} |
|
|
1062 |
free(clientargs[0]); |
1053 |
|
1063 |
|
1054 |
// Wait for client or server to exit, possibly kill server. |
1064 |
// Wait for client or server to exit, possibly kill server. |
1055 |
while (client > 0) { |
1065 |
while (client > 0) { |