]> Zhao Yanbai Git Server - minix.git/commitdiff
. verbose recovery of tcpd
authorBen Gras <ben@minix3.org>
Wed, 15 Mar 2006 14:39:20 +0000 (14:39 +0000)
committerBen Gras <ben@minix3.org>
Wed, 15 Mar 2006 14:39:20 +0000 (14:39 +0000)
 . chroot shows exit status to parent

commands/simple/chroot.c
commands/simple/tcpd.c

index 3e628a58646d96e29b227c0e6f8fd4f1e177a203..f9758de4f13bf66f12d086003874308af7adbf93 100644 (file)
@@ -3,9 +3,13 @@
 #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;
@@ -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;
 }
 
index b98afb825760c76ebc5a176818d43825df28dab3..f674923e007ae06df731d168ad9578e9cf6bbc26 100755 (executable)
@@ -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;