diff --git a/src/client/distren.c b/src/client/distren.c --- a/src/client/distren.c +++ b/src/client/distren.c @@ -19,7 +19,9 @@ #include /* sprintf, printf */ #include /* malloc, free */ + #include "options.h" +#include "execio.h" int main(int argc, char *argv[]) { @@ -28,8 +30,10 @@ int main(int argc, char *argv[]) { "ssh", "protofusion.org", - "echo", - "hello from protofusion.org" + "sh", + "-c", + "\"echo hello from ${HOSTNAME} 1>&2\"", + (char *)NULL }; fprintf(stderr, "testing execio (It shouldn't work) :-)\n"); diff --git a/src/common/execio.c b/src/common/execio.c --- a/src/common/execio.c +++ b/src/common/execio.c @@ -40,6 +40,7 @@ int execio_open(struct execio **rem, con int counter; int counter2; + int maxfds; /* create two pipes to facilitate communication with child */ if(pipe(pipe_write)) @@ -111,6 +112,7 @@ int execio_open(struct execio **rem, con if(counter < pipe_read[1]) counter = pipe_read[1]; counter2 = 0; + maxfds = counter; while(counter > 2) { if(!close(counter)) @@ -119,7 +121,7 @@ int execio_open(struct execio **rem, con } /* stderr is the only stream we haven't confiscated atm - just for fun - I will confiscate it later, though, to support parsing error messages */ - fprintf(stderr, "closed %d fds before execing \"%s\"\n", counter2, progname); + fprintf(stderr, "closed %d/%d fds before execing \"%s\"\n", counter2, maxfds, progname); /* now exec: execvp uses interpreter to find the file to exec diff --git a/src/common/execio.h b/src/common/execio.h --- a/src/common/execio.h +++ b/src/common/execio.h @@ -41,7 +41,11 @@ struct execio pid_t child; }; -/* nonzsero return on error */ +/* + runs progname with the arguments in argv. argv must be null terminated!!!!!!!!! + + returns nonzsero return on error +*/ int execio_open(struct execio **rem, const char *progname, char *const argv[]); /*