diff options
author | Karoly Lorentey <karoly@lorentey.hu> | 2007-04-22 12:42:47 +0000 |
---|---|---|
committer | Karoly Lorentey <karoly@lorentey.hu> | 2007-04-22 12:42:47 +0000 |
commit | 9d0799072a0d09bc14a99eaf372b262d1ba61399 (patch) | |
tree | 76acd4ae0559776a5ec27fbd5c25598285ec71d1 /src/process.c | |
parent | e18c709364b095ea0be8ecabe458ac9a642a252f (diff) | |
parent | a20becf321f023c6dc1831595712576d64e2ef4b (diff) | |
download | emacs-9d0799072a0d09bc14a99eaf372b262d1ba61399.tar.gz emacs-9d0799072a0d09bc14a99eaf372b262d1ba61399.tar.bz2 emacs-9d0799072a0d09bc14a99eaf372b262d1ba61399.zip |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-674
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-675
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-676
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-677
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-678
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-679
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-680
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-681
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-682
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-683
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-684
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-685
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-686
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-687
Release ERC 5.2.
* emacs@sv.gnu.org/emacs--devo--0--patch-688
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-689
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-690
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-691
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-692
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-693
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-694
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-695
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-696
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-697
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-698
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-699
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-700
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-701
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-209
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-210
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-211
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-212
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-213
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-214
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-215
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-601
Diffstat (limited to 'src/process.c')
-rw-r--r-- | src/process.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/src/process.c b/src/process.c index 6d84d4c4a87..56e4335ca2c 100644 --- a/src/process.c +++ b/src/process.c @@ -1268,7 +1268,7 @@ Returns nil if format of ADDRESS is invalid. */) if (VECTORP (address)) /* AF_INET or AF_INET6 */ { register struct Lisp_Vector *p = XVECTOR (address); - Lisp_Object args[6]; + Lisp_Object args[10]; int nargs, i; if (p->size == 4 || (p->size == 5 && !NILP (omit_port))) @@ -1295,7 +1295,20 @@ Returns nil if format of ADDRESS is invalid. */) return Qnil; for (i = 0; i < nargs; i++) - args[i+1] = p->contents[i]; + { + EMACS_INT element = XINT (p->contents[i]); + + if (element < 0 || element > 65535) + return Qnil; + + if (nargs <= 5 /* IPv4 */ + && i < 4 /* host, not port */ + && element > 255) + return Qnil; + + args[i+1] = p->contents[i]; + } + return Fformat (nargs+1, args); } @@ -1305,7 +1318,6 @@ Returns nil if format of ADDRESS is invalid. */) args[0] = build_string ("<Family %d>"); args[1] = Fcar (address); return Fformat (2, args); - } return Qnil; @@ -1411,7 +1423,6 @@ list_processes_1 (query_only) if (CONSP (p->status)) symbol = XCAR (p->status); - if (EQ (symbol, Qsignal)) { Lisp_Object tem; @@ -4811,8 +4822,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, subprocess termination and SIGCHLD. */ else if (nread == 0 && !NETCONN_P (proc)) ; -#endif /* O_NDELAY */ -#endif /* O_NONBLOCK */ +#endif /* O_NDELAY */ +#endif /* O_NONBLOCK */ #ifdef HAVE_PTYS /* On some OSs with ptys, when the process on one end of a pty exits, the other end gets an error reading with @@ -4823,11 +4834,17 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, get a SIGCHLD). However, it has been known to happen that the SIGCHLD - got lost. So raise the signl again just in case. + got lost. So raise the signal again just in case. It can't hurt. */ else if (nread == -1 && errno == EIO) - kill (getpid (), SIGCHLD); -#endif /* HAVE_PTYS */ + { + /* Clear the descriptor now, so we only raise the signal once. */ + FD_CLR (channel, &input_wait_mask); + FD_CLR (channel, &non_keyboard_wait_mask); + + kill (getpid (), SIGCHLD); + } +#endif /* HAVE_PTYS */ /* If we can detect process termination, don't consider the process gone just because its pipe is closed. */ #ifdef SIGCHLD @@ -6506,17 +6523,12 @@ sigchld_handler (signo) #define WUNTRACED 0 #endif /* no WUNTRACED */ /* Keep trying to get a status until we get a definitive result. */ - while (1) - { + do + { errno = 0; pid = wait3 (&w, WNOHANG | WUNTRACED, 0); - if (! (pid < 0 && errno == EINTR)) - break; - /* Avoid a busyloop: wait3 is a system call, so we do not want - to prevent the kernel from actually sending SIGCHLD to emacs - by asking for it all the time. */ - sleep (1); } + while (pid < 0 && errno == EINTR); if (pid <= 0) { |