mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-18 08:02:48 +00:00
91 lines
2.3 KiB
Plaintext
91 lines
2.3 KiB
Plaintext
--- ile.c.orig Tue Jun 8 20:12:33 1993
|
|
+++ ile.c Sun Nov 3 15:10:18 2002
|
|
@@ -47,11 +47,12 @@
|
|
#include <string.h>
|
|
#include <strings.h>
|
|
#include <pwd.h>
|
|
+#include <sys/types.h>
|
|
#include <utmp.h>
|
|
#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 +64,6 @@
|
|
/* Definitions of system stuff. */
|
|
extern int errno;
|
|
|
|
-long lseek();
|
|
char *malloc();
|
|
char *realloc();
|
|
time_t time();
|
|
@@ -113,7 +113,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 +267,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));
|
|
}
|
|
}
|
|
|