. chroot shows exit status to parent
#include <stdio.h>
#include <stdlib.h>
+#include <sys/wait.h>
+
int
main(int argc, char *argv[])
{
+ int status;
+
if(argc != 3) {
fprintf(stderr, "usage: %s <root> <command>\n", argv[0]);
return 1;
return 1;
}
- system(argv[2]);
-
- return 0;
+ status = system(argv[2]);
+ if(WIFEXITED(status))
+ return WEXITSTATUS(status);
+ return 1;
}
int main(int argc, char **argv)
{
tcpport_t port;
+ int last_failed = 0;
struct nwio_tcpcl tcplistenopt;
struct nwio_tcpconf tcpconf;
struct nwio_tcpopt tcpopt;
exit(1);
}
#endif
+ last_failed = 1;
goto bad;
}
+ if(last_failed)
+ fprintf(stderr, "%s %s: %s: Ok\n",
+ arg0, service, tcp_device);
+ last_failed = 0;
tcpconf.nwtc_flags= NWTC_LP_SET | NWTC_UNSET_RA | NWTC_UNSET_RP;
tcpconf.nwtc_locport= port;