diff --git a/commands/simple/chroot.c b/commands/simple/chroot.c index 3e628a586..f9758de4f 100644 --- a/commands/simple/chroot.c +++ b/commands/simple/chroot.c @@ -3,9 +3,13 @@ #include #include +#include + int main(int argc, char *argv[]) { + int status; + if(argc != 3) { fprintf(stderr, "usage: %s \n", argv[0]); return 1; @@ -16,8 +20,9 @@ main(int argc, char *argv[]) return 1; } - system(argv[2]); - - return 0; + status = system(argv[2]); + if(WIFEXITED(status)) + return WEXITSTATUS(status); + return 1; } diff --git a/commands/simple/tcpd.c b/commands/simple/tcpd.c index b98afb825..f674923e0 100755 --- a/commands/simple/tcpd.c +++ b/commands/simple/tcpd.c @@ -64,6 +64,7 @@ static void usage(void) 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; @@ -179,8 +180,13 @@ int main(int argc, char **argv) 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;