aboutsummaryrefslogtreecommitdiffstats
path: root/misc/lile/files/patch-aa
blob: c79a2cba80ee1603a29dafcab37603a43e1fa3c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
--- ile.c   Tue Jun  8 23:12:33 1993
+++ ile.c   Tue Jun  4 20:34:21 2002
@@ -51,7 +51,7 @@
 #include <errno.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
-#include <sys/dir.h>
+#include <sys/dirent.h>
 #include <sys/file.h>
 #include <sys/time.h>
 #include <sys/wait.h>
@@ -63,7 +63,6 @@
 /* Definitions of system stuff.  */
 extern int errno;
 
-long lseek();
 char *malloc();
 char *realloc();
 time_t time();
@@ -113,7 +112,7 @@
 struct ltchars tty_ltchars;
 struct winsize tty_winsize;
 int expect_exception, ignorestop, new_prompt, output_complete;
-int childpid;
+pid_t childpid;
 int tty_ldisc;
 int tty_mode;
 
@@ -267,44 +266,46 @@
 did, i.e., suspend, abort, exit with the proper status etc.
 */
 void handle_child() {
-    union wait status;
+    int status;
 
     if (wait3(&status, WUNTRACED, NULL) != childpid) {
    fprintf(stderr, "ile: notified by unknown process\r\n");
+   /* note the change so that we don't die after select */
+   expect_exception = TRUE;
    return;
     }
 
     if (WIFSTOPPED(status)) {
    /* ignore stop signals that we forwarded to the child */
-   if (status.w_stopsig == SIGSTOP && ignorestop) {
+   if (WSTOPSIG(status) == SIGSTOP && ignorestop) {
        ignorestop = FALSE;
        return;
    }
 
 #ifdef DEBUG
-   fprintf(stderr, "child stopped by signal %d\r\n", status.w_stopsig);
+   fprintf(stderr, "child stopped by signal %d\r\n", WSTOPSIG(status));
 #endif
    /* stop ourselves */
-   handle_stop(status.w_stopsig);
+   handle_stop(WSTOPSIG(status));
     }
     else if (WIFSIGNALED(status)) {
 #ifdef DEBUG
-   fprintf(stderr, "child killed by signal %d\r\n", status.w_termsig);
+   fprintf(stderr, "child killed by signal %d\r\n", WTERMSIG(status));
 #endif
    clean_up();
 
-   if (status.w_coredump) {
+   if (WCOREDUMP(status)) {
        chdir ("/");        /* prevent own core dump */
    }
-   (void) signal (status.w_termsig, SIG_DFL);
-   kill (getpid(), status.w_termsig);
+   (void) signal (WTERMSIG(status), SIG_DFL);
+   kill (getpid(), WTERMSIG(status));
     }
     else {
 #ifdef DEBUG
-   fprintf(stderr, "child exited with %d\r\n", status.w_retcode);
+   fprintf(stderr, "child exited with %d\r\n", WEXITSTATUS(status));
 #endif
    clean_up();
-   exit (status.w_retcode);
+   exit (WEXITSTATUS(status));
     }
 }