diff options
| -rw-r--r-- | dtach.h | 1 | ||||
| -rw-r--r-- | master.c | 11 |
2 files changed, 11 insertions, 1 deletions
@@ -83,6 +83,7 @@ #include <sys/stat.h> #include <sys/socket.h> #include <sys/un.h> +#include <sys/wait.h> #ifndef S_ISREG #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) @@ -134,7 +134,7 @@ init_pty(char **argv, int statusfd) printf("%s: could not execute %s: %s\r\n", progname, *argv, strerror(errno)); fflush(stdout); - _exit(127); + _exit(1); } /* Parent.. Finish up and return */ #ifdef BROKEN_MASTER @@ -261,7 +261,16 @@ pty_activity(int s) /* Error -> die */ if (len <= 0) + { + int status; + + if (wait(&status) >= 0) + { + if (WIFEXITED(status)) + exit(WEXITSTATUS(status)); + } exit(1); + } #ifdef BROKEN_MASTER /* Get the current terminal settings. */ |
