. verbose recovery of tcpd

. chroot shows exit status to parent
This commit is contained in:
Ben Gras 2006-03-15 14:39:20 +00:00
parent 7fecfd3740
commit e07a62161a
2 changed files with 14 additions and 3 deletions

View file

@ -3,9 +3,13 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/wait.h>
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int status;
if(argc != 3) { if(argc != 3) {
fprintf(stderr, "usage: %s <root> <command>\n", argv[0]); fprintf(stderr, "usage: %s <root> <command>\n", argv[0]);
return 1; return 1;
@ -16,8 +20,9 @@ main(int argc, char *argv[])
return 1; return 1;
} }
system(argv[2]); status = system(argv[2]);
if(WIFEXITED(status))
return 0; return WEXITSTATUS(status);
return 1;
} }

View file

@ -64,6 +64,7 @@ static void usage(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
tcpport_t port; tcpport_t port;
int last_failed = 0;
struct nwio_tcpcl tcplistenopt; struct nwio_tcpcl tcplistenopt;
struct nwio_tcpconf tcpconf; struct nwio_tcpconf tcpconf;
struct nwio_tcpopt tcpopt; struct nwio_tcpopt tcpopt;
@ -179,8 +180,13 @@ int main(int argc, char **argv)
exit(1); exit(1);
} }
#endif #endif
last_failed = 1;
goto bad; 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_flags= NWTC_LP_SET | NWTC_UNSET_RA | NWTC_UNSET_RP;
tcpconf.nwtc_locport= port; tcpconf.nwtc_locport= port;