diff options
| author | Richard M. Stallman | 1993-11-23 10:57:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-11-23 10:57:16 +0000 |
| commit | a9f2c8845bbca54dad475aaf1ee13e4615469883 (patch) | |
| tree | 72375b60d1e80507537fbcc6d2a559e239958986 /src/process.c | |
| parent | 990acea371eac5e66c2f0fd918d204ae367ba665 (diff) | |
| download | emacs-a9f2c8845bbca54dad475aaf1ee13e4615469883.tar.gz emacs-a9f2c8845bbca54dad475aaf1ee13e4615469883.zip | |
(wait_reading_process_input):
Use -1 to mean wait_channel is empty.
Start process loop with descriptor 0 if keyboard_descriptor is not 0.
(make_process): Initialize descriptors to -1.
(Fdelete_process): -1 means empty, in infd.
(deactivate_process): Likewise.
(process_send_signal): Likewise.
(kill_buffer_processes): Likewise.
(sigchld_handler): Likewise.
(status_notify): Likewise.
(close_process_descs): Likewise.
(create_process): Likewise.
(Fopen_network_stream): Likewise.
(send_process): Likewise.
(Fprocess_send_eof): Likewise. Use XINT when closing outfd.
(Fset_process_filter): Use XINT to get infd value.
(wait_reading_process_input): Likewise.
(wait_reading_process_input): When bypassing select, clear Available.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 100 |
1 files changed, 53 insertions, 47 deletions
diff --git a/src/process.c b/src/process.c index 0daa81fa210..6dcb2f93447 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -435,8 +435,8 @@ make_process (name) | |||
| 435 | XSETTYPE (val, Lisp_Process); | 435 | XSETTYPE (val, Lisp_Process); |
| 436 | 436 | ||
| 437 | p = XPROCESS (val); | 437 | p = XPROCESS (val); |
| 438 | XFASTINT (p->infd) = 0; | 438 | XSET (p->infd, Lisp_Int, -1); |
| 439 | XFASTINT (p->outfd) = 0; | 439 | XSET (p->outfd, Lisp_Int, -1); |
| 440 | XFASTINT (p->pid) = 0; | 440 | XFASTINT (p->pid) = 0; |
| 441 | XFASTINT (p->tick) = 0; | 441 | XFASTINT (p->tick) = 0; |
| 442 | XFASTINT (p->update_tick) = 0; | 442 | XFASTINT (p->update_tick) = 0; |
| @@ -557,7 +557,7 @@ nil, indicating the current buffer's process.") | |||
| 557 | XPROCESS (proc)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); | 557 | XPROCESS (proc)->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); |
| 558 | XSETINT (XPROCESS (proc)->tick, ++process_tick); | 558 | XSETINT (XPROCESS (proc)->tick, ++process_tick); |
| 559 | } | 559 | } |
| 560 | else if (XFASTINT (XPROCESS (proc)->infd)) | 560 | else if (XINT (XPROCESS (proc)->infd >= 0)) |
| 561 | { | 561 | { |
| 562 | Fkill_process (proc, Qnil); | 562 | Fkill_process (proc, Qnil); |
| 563 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ | 563 | /* Do this now, since remove_process will make sigchld_handler do nothing. */ |
| @@ -702,9 +702,9 @@ If the process has a filter, its buffer is not used for output.") | |||
| 702 | { | 702 | { |
| 703 | CHECK_PROCESS (proc, 0); | 703 | CHECK_PROCESS (proc, 0); |
| 704 | if (EQ (filter, Qt)) | 704 | if (EQ (filter, Qt)) |
| 705 | FD_CLR (XPROCESS (proc)->infd, &input_wait_mask); | 705 | FD_CLR (XINT (XPROCESS (proc)->infd), &input_wait_mask); |
| 706 | else if (EQ (XPROCESS (proc)->filter, Qt)) | 706 | else if (EQ (XPROCESS (proc)->filter, Qt)) |
| 707 | FD_SET (XPROCESS (proc)->infd, &input_wait_mask); | 707 | FD_SET (XINT (XPROCESS (proc)->infd), &input_wait_mask); |
| 708 | XPROCESS (proc)->filter = filter; | 708 | XPROCESS (proc)->filter = filter; |
| 709 | return filter; | 709 | return filter; |
| 710 | } | 710 | } |
| @@ -1166,8 +1166,8 @@ create_process (process, new_argv, current_dir) | |||
| 1166 | /* Record this as an active process, with its channels. | 1166 | /* Record this as an active process, with its channels. |
| 1167 | As a result, child_setup will close Emacs's side of the pipes. */ | 1167 | As a result, child_setup will close Emacs's side of the pipes. */ |
| 1168 | chan_process[inchannel] = process; | 1168 | chan_process[inchannel] = process; |
| 1169 | XFASTINT (XPROCESS (process)->infd) = inchannel; | 1169 | XSET (XPROCESS (process)->infd, Lisp_Int, inchannel); |
| 1170 | XFASTINT (XPROCESS (process)->outfd) = outchannel; | 1170 | XSET (XPROCESS (process)->outfd, Lisp_Int, outchannel); |
| 1171 | /* Record the tty descriptor used in the subprocess. */ | 1171 | /* Record the tty descriptor used in the subprocess. */ |
| 1172 | if (forkin < 0) | 1172 | if (forkin < 0) |
| 1173 | XPROCESS (process)->subtty = Qnil; | 1173 | XPROCESS (process)->subtty = Qnil; |
| @@ -1489,8 +1489,8 @@ Fourth arg SERVICE is name of the service desired, or an integer\n\ | |||
| 1489 | XPROCESS (proc)->filter = Qnil; | 1489 | XPROCESS (proc)->filter = Qnil; |
| 1490 | XPROCESS (proc)->command = Qnil; | 1490 | XPROCESS (proc)->command = Qnil; |
| 1491 | XPROCESS (proc)->pid = Qnil; | 1491 | XPROCESS (proc)->pid = Qnil; |
| 1492 | XFASTINT (XPROCESS (proc)->infd) = s; | 1492 | XSET (XPROCESS (proc)->infd, Lisp_Int, s); |
| 1493 | XFASTINT (XPROCESS (proc)->outfd) = outch; | 1493 | XSET (XPROCESS (proc)->outfd, Lisp_Int, outch); |
| 1494 | XPROCESS (proc)->status = Qrun; | 1494 | XPROCESS (proc)->status = Qrun; |
| 1495 | FD_SET (inch, &input_wait_mask); | 1495 | FD_SET (inch, &input_wait_mask); |
| 1496 | 1496 | ||
| @@ -1505,10 +1505,10 @@ deactivate_process (proc) | |||
| 1505 | register int inchannel, outchannel; | 1505 | register int inchannel, outchannel; |
| 1506 | register struct Lisp_Process *p = XPROCESS (proc); | 1506 | register struct Lisp_Process *p = XPROCESS (proc); |
| 1507 | 1507 | ||
| 1508 | inchannel = XFASTINT (p->infd); | 1508 | inchannel = XINT (p->infd); |
| 1509 | outchannel = XFASTINT (p->outfd); | 1509 | outchannel = XINT (p->outfd); |
| 1510 | 1510 | ||
| 1511 | if (inchannel) | 1511 | if (inchannel >= 0) |
| 1512 | { | 1512 | { |
| 1513 | /* Beware SIGCHLD hereabouts. */ | 1513 | /* Beware SIGCHLD hereabouts. */ |
| 1514 | flush_pending_output (inchannel); | 1514 | flush_pending_output (inchannel); |
| @@ -1522,12 +1522,12 @@ deactivate_process (proc) | |||
| 1522 | } | 1522 | } |
| 1523 | #else | 1523 | #else |
| 1524 | close (inchannel); | 1524 | close (inchannel); |
| 1525 | if (outchannel && outchannel != inchannel) | 1525 | if (outchannel >= 0 && outchannel != inchannel) |
| 1526 | close (outchannel); | 1526 | close (outchannel); |
| 1527 | #endif | 1527 | #endif |
| 1528 | 1528 | ||
| 1529 | XFASTINT (p->infd) = 0; | 1529 | XSET (p->infd, Lisp_Int, -1); |
| 1530 | XFASTINT (p->outfd) = 0; | 1530 | XSET (p->outfd, Lisp_Int, -1); |
| 1531 | chan_process[inchannel] = Qnil; | 1531 | chan_process[inchannel] = Qnil; |
| 1532 | FD_CLR (inchannel, &input_wait_mask); | 1532 | FD_CLR (inchannel, &input_wait_mask); |
| 1533 | } | 1533 | } |
| @@ -1546,11 +1546,11 @@ close_process_descs () | |||
| 1546 | process = chan_process[i]; | 1546 | process = chan_process[i]; |
| 1547 | if (!NILP (process)) | 1547 | if (!NILP (process)) |
| 1548 | { | 1548 | { |
| 1549 | int in = XFASTINT (XPROCESS (process)->infd); | 1549 | int in = XINT (XPROCESS (process)->infd); |
| 1550 | int out = XFASTINT (XPROCESS (process)->outfd); | 1550 | int out = XINT (XPROCESS (process)->outfd); |
| 1551 | if (in) | 1551 | if (in >= 0) |
| 1552 | close (in); | 1552 | close (in); |
| 1553 | if (out && in != out) | 1553 | if (out >= 0 && in != out) |
| 1554 | close (out); | 1554 | close (out); |
| 1555 | } | 1555 | } |
| 1556 | } | 1556 | } |
| @@ -1672,7 +1672,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1672 | Lisp_Object proc; | 1672 | Lisp_Object proc; |
| 1673 | EMACS_TIME timeout, end_time, garbage; | 1673 | EMACS_TIME timeout, end_time, garbage; |
| 1674 | SELECT_TYPE Atemp; | 1674 | SELECT_TYPE Atemp; |
| 1675 | int wait_channel = 0; | 1675 | int wait_channel = -1; |
| 1676 | struct Lisp_Process *wait_proc = 0; | 1676 | struct Lisp_Process *wait_proc = 0; |
| 1677 | int got_some_input = 0; | 1677 | int got_some_input = 0; |
| 1678 | Lisp_Object *wait_for_cell = 0; | 1678 | Lisp_Object *wait_for_cell = 0; |
| @@ -1684,7 +1684,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1684 | if (XTYPE (read_kbd) == Lisp_Process) | 1684 | if (XTYPE (read_kbd) == Lisp_Process) |
| 1685 | { | 1685 | { |
| 1686 | wait_proc = XPROCESS (read_kbd); | 1686 | wait_proc = XPROCESS (read_kbd); |
| 1687 | wait_channel = XFASTINT (wait_proc->infd); | 1687 | wait_channel = XINT (wait_proc->infd); |
| 1688 | XFASTINT (read_kbd) = 0; | 1688 | XFASTINT (read_kbd) = 0; |
| 1689 | } | 1689 | } |
| 1690 | 1690 | ||
| @@ -1794,7 +1794,10 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1794 | redisplay_preserve_echo_area (); | 1794 | redisplay_preserve_echo_area (); |
| 1795 | 1795 | ||
| 1796 | if (XINT (read_kbd) && detect_input_pending ()) | 1796 | if (XINT (read_kbd) && detect_input_pending ()) |
| 1797 | nfds = 0; | 1797 | { |
| 1798 | nfds = 0; | ||
| 1799 | FD_ZERO (&Available); | ||
| 1800 | } | ||
| 1798 | else | 1801 | else |
| 1799 | nfds = select (MAXDESC, &Available, 0, 0, &timeout); | 1802 | nfds = select (MAXDESC, &Available, 0, 0, &timeout); |
| 1800 | 1803 | ||
| @@ -1895,8 +1898,11 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1895 | if (XINT (read_kbd) || wait_for_cell) | 1898 | if (XINT (read_kbd) || wait_for_cell) |
| 1896 | do_pending_window_change (); | 1899 | do_pending_window_change (); |
| 1897 | 1900 | ||
| 1898 | /* Check for data from a process or a command channel */ | 1901 | /* Check for data from a process. */ |
| 1899 | for (channel = FIRST_PROC_DESC; channel < MAXDESC; channel++) | 1902 | /* Really FIRST_PROC_DESC should be 0 on Unix, |
| 1903 | but this is safer in the short run. */ | ||
| 1904 | for (channel = keyboard_descriptor == 0 ? FIRST_PROC_DESC : 0; | ||
| 1905 | channel < MAXDESC; channel++) | ||
| 1900 | { | 1906 | { |
| 1901 | if (FD_ISSET (channel, &Available)) | 1907 | if (FD_ISSET (channel, &Available)) |
| 1902 | { | 1908 | { |
| @@ -1907,7 +1913,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 1907 | waiting. */ | 1913 | waiting. */ |
| 1908 | if (wait_channel == channel) | 1914 | if (wait_channel == channel) |
| 1909 | { | 1915 | { |
| 1910 | wait_channel = 0; | 1916 | wait_channel = -1; |
| 1911 | time_limit = -1; | 1917 | time_limit = -1; |
| 1912 | got_some_input = 1; | 1918 | got_some_input = 1; |
| 1913 | } | 1919 | } |
| @@ -2205,7 +2211,7 @@ send_process (proc, buf, len) | |||
| 2205 | if (this > 500) | 2211 | if (this > 500) |
| 2206 | this = 500; | 2212 | this = 500; |
| 2207 | old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap); | 2213 | old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap); |
| 2208 | rv = write (XFASTINT (XPROCESS (proc)->outfd), buf, this); | 2214 | rv = write (XINT (XPROCESS (proc)->outfd), buf, this); |
| 2209 | signal (SIGPIPE, old_sigpipe); | 2215 | signal (SIGPIPE, old_sigpipe); |
| 2210 | if (rv < 0) | 2216 | if (rv < 0) |
| 2211 | { | 2217 | { |
| @@ -2331,7 +2337,7 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 2331 | if (!EQ (p->childp, Qt)) | 2337 | if (!EQ (p->childp, Qt)) |
| 2332 | error ("Process %s is not a subprocess", | 2338 | error ("Process %s is not a subprocess", |
| 2333 | XSTRING (p->name)->data); | 2339 | XSTRING (p->name)->data); |
| 2334 | if (!XFASTINT (p->infd)) | 2340 | if (XINT (p->infd) < 0) |
| 2335 | error ("Process %s is not active", | 2341 | error ("Process %s is not active", |
| 2336 | XSTRING (p->name)->data); | 2342 | XSTRING (p->name)->data); |
| 2337 | 2343 | ||
| @@ -2353,17 +2359,17 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 2353 | switch (signo) | 2359 | switch (signo) |
| 2354 | { | 2360 | { |
| 2355 | case SIGINT: | 2361 | case SIGINT: |
| 2356 | tcgetattr (XFASTINT (p->infd), &t); | 2362 | tcgetattr (XINT (p->infd), &t); |
| 2357 | send_process (proc, &t.c_cc[VINTR], 1); | 2363 | send_process (proc, &t.c_cc[VINTR], 1); |
| 2358 | return; | 2364 | return; |
| 2359 | 2365 | ||
| 2360 | case SIGQUIT: | 2366 | case SIGQUIT: |
| 2361 | tcgetattr (XFASTINT (p->infd), &t); | 2367 | tcgetattr (XINT (p->infd), &t); |
| 2362 | send_process (proc, &t.c_cc[VQUIT], 1); | 2368 | send_process (proc, &t.c_cc[VQUIT], 1); |
| 2363 | return; | 2369 | return; |
| 2364 | 2370 | ||
| 2365 | case SIGTSTP: | 2371 | case SIGTSTP: |
| 2366 | tcgetattr (XFASTINT (p->infd), &t); | 2372 | tcgetattr (XINT (p->infd), &t); |
| 2367 | #ifdef VSWTCH | 2373 | #ifdef VSWTCH |
| 2368 | send_process (proc, &t.c_cc[VSWTCH], 1); | 2374 | send_process (proc, &t.c_cc[VSWTCH], 1); |
| 2369 | #else | 2375 | #else |
| @@ -2384,16 +2390,16 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 2384 | switch (signo) | 2390 | switch (signo) |
| 2385 | { | 2391 | { |
| 2386 | case SIGINT: | 2392 | case SIGINT: |
| 2387 | ioctl (XFASTINT (p->infd), TIOCGETC, &c); | 2393 | ioctl (XINT (p->infd), TIOCGETC, &c); |
| 2388 | send_process (proc, &c.t_intrc, 1); | 2394 | send_process (proc, &c.t_intrc, 1); |
| 2389 | return; | 2395 | return; |
| 2390 | case SIGQUIT: | 2396 | case SIGQUIT: |
| 2391 | ioctl (XFASTINT (p->infd), TIOCGETC, &c); | 2397 | ioctl (XINT (p->infd), TIOCGETC, &c); |
| 2392 | send_process (proc, &c.t_quitc, 1); | 2398 | send_process (proc, &c.t_quitc, 1); |
| 2393 | return; | 2399 | return; |
| 2394 | #ifdef SIGTSTP | 2400 | #ifdef SIGTSTP |
| 2395 | case SIGTSTP: | 2401 | case SIGTSTP: |
| 2396 | ioctl (XFASTINT (p->infd), TIOCGLTC, &lc); | 2402 | ioctl (XINT (p->infd), TIOCGLTC, &lc); |
| 2397 | send_process (proc, &lc.t_suspc, 1); | 2403 | send_process (proc, &lc.t_suspc, 1); |
| 2398 | return; | 2404 | return; |
| 2399 | #endif /* ! defined (SIGTSTP) */ | 2405 | #endif /* ! defined (SIGTSTP) */ |
| @@ -2408,16 +2414,16 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 2408 | switch (signo) | 2414 | switch (signo) |
| 2409 | { | 2415 | { |
| 2410 | case SIGINT: | 2416 | case SIGINT: |
| 2411 | ioctl (XFASTINT (p->infd), TCGETA, &t); | 2417 | ioctl (XINT (p->infd), TCGETA, &t); |
| 2412 | send_process (proc, &t.c_cc[VINTR], 1); | 2418 | send_process (proc, &t.c_cc[VINTR], 1); |
| 2413 | return; | 2419 | return; |
| 2414 | case SIGQUIT: | 2420 | case SIGQUIT: |
| 2415 | ioctl (XFASTINT (p->infd), TCGETA, &t); | 2421 | ioctl (XINT (p->infd), TCGETA, &t); |
| 2416 | send_process (proc, &t.c_cc[VQUIT], 1); | 2422 | send_process (proc, &t.c_cc[VQUIT], 1); |
| 2417 | return; | 2423 | return; |
| 2418 | #ifdef SIGTSTP | 2424 | #ifdef SIGTSTP |
| 2419 | case SIGTSTP: | 2425 | case SIGTSTP: |
| 2420 | ioctl (XFASTINT (p->infd), TCGETA, &t); | 2426 | ioctl (XINT (p->infd), TCGETA, &t); |
| 2421 | send_process (proc, &t.c_cc[VSWTCH], 1); | 2427 | send_process (proc, &t.c_cc[VSWTCH], 1); |
| 2422 | return; | 2428 | return; |
| 2423 | #endif /* ! defined (SIGTSTP) */ | 2429 | #endif /* ! defined (SIGTSTP) */ |
| @@ -2445,7 +2451,7 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 2445 | if (!NILP (p->subtty)) | 2451 | if (!NILP (p->subtty)) |
| 2446 | err = ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid); | 2452 | err = ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid); |
| 2447 | else | 2453 | else |
| 2448 | err = ioctl (XFASTINT (p->infd), TIOCGPGRP, &gid); | 2454 | err = ioctl (XINT (p->infd), TIOCGPGRP, &gid); |
| 2449 | 2455 | ||
| 2450 | #ifdef pfa | 2456 | #ifdef pfa |
| 2451 | if (err == -1) | 2457 | if (err == -1) |
| @@ -2492,7 +2498,7 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 2492 | sys$forcex (&(XFASTINT (p->pid)), 0, 1); | 2498 | sys$forcex (&(XFASTINT (p->pid)), 0, 1); |
| 2493 | whoosh: | 2499 | whoosh: |
| 2494 | #endif | 2500 | #endif |
| 2495 | flush_pending_output (XFASTINT (p->infd)); | 2501 | flush_pending_output (XINT (p->infd)); |
| 2496 | break; | 2502 | break; |
| 2497 | } | 2503 | } |
| 2498 | 2504 | ||
| @@ -2508,7 +2514,7 @@ process_send_signal (process, signo, current_group, nomsg) | |||
| 2508 | /* gid may be a pid, or minus a pgrp's number */ | 2514 | /* gid may be a pid, or minus a pgrp's number */ |
| 2509 | #ifdef TIOCSIGSEND | 2515 | #ifdef TIOCSIGSEND |
| 2510 | if (!NILP (current_group)) | 2516 | if (!NILP (current_group)) |
| 2511 | ioctl (XFASTINT (p->infd), TIOCSIGSEND, signo); | 2517 | ioctl (XINT (p->infd), TIOCSIGSEND, signo); |
| 2512 | else | 2518 | else |
| 2513 | { | 2519 | { |
| 2514 | gid = - XFASTINT (p->pid); | 2520 | gid = - XFASTINT (p->pid); |
| @@ -2618,7 +2624,7 @@ nil, indicating the current buffer's process.") | |||
| 2618 | #ifdef DID_REMOTE | 2624 | #ifdef DID_REMOTE |
| 2619 | { | 2625 | { |
| 2620 | char buf[1]; | 2626 | char buf[1]; |
| 2621 | write (XFASTINT (XPROCESS (proc)->outfd), buf, 0); | 2627 | write (XINT (XPROCESS (proc)->outfd), buf, 0); |
| 2622 | } | 2628 | } |
| 2623 | #else /* did not do TOICREMOTE */ | 2629 | #else /* did not do TOICREMOTE */ |
| 2624 | #ifdef VMS | 2630 | #ifdef VMS |
| @@ -2628,8 +2634,8 @@ nil, indicating the current buffer's process.") | |||
| 2628 | send_process (proc, "\004", 1); | 2634 | send_process (proc, "\004", 1); |
| 2629 | else | 2635 | else |
| 2630 | { | 2636 | { |
| 2631 | close (XPROCESS (proc)->outfd); | 2637 | close (XINT (XPROCESS (proc)->outfd)); |
| 2632 | XFASTINT (XPROCESS (proc)->outfd) = open (NULL_DEVICE, O_WRONLY); | 2638 | XSET (XPROCESS (proc)->outfd, Lisp_Int, open (NULL_DEVICE, O_WRONLY)); |
| 2633 | } | 2639 | } |
| 2634 | #endif /* VMS */ | 2640 | #endif /* VMS */ |
| 2635 | #endif /* did not do TOICREMOTE */ | 2641 | #endif /* did not do TOICREMOTE */ |
| @@ -2653,7 +2659,7 @@ kill_buffer_processes (buffer) | |||
| 2653 | { | 2659 | { |
| 2654 | if (NETCONN_P (proc)) | 2660 | if (NETCONN_P (proc)) |
| 2655 | deactivate_process (proc); | 2661 | deactivate_process (proc); |
| 2656 | else if (XFASTINT (XPROCESS (proc)->infd)) | 2662 | else if (XINT (XPROCESS (proc)->infd) >= 0) |
| 2657 | process_send_signal (proc, SIGHUP, Qnil, 1); | 2663 | process_send_signal (proc, SIGHUP, Qnil, 1); |
| 2658 | } | 2664 | } |
| 2659 | } | 2665 | } |
| @@ -2768,8 +2774,8 @@ sigchld_handler (signo) | |||
| 2768 | 2774 | ||
| 2769 | /* If process has terminated, stop waiting for its output. */ | 2775 | /* If process has terminated, stop waiting for its output. */ |
| 2770 | if (WIFSIGNALED (w) || WIFEXITED (w)) | 2776 | if (WIFSIGNALED (w) || WIFEXITED (w)) |
| 2771 | if (XFASTINT (p->infd)) | 2777 | if (XINT (p->infd) >= 0) |
| 2772 | FD_CLR (XFASTINT (p->infd), &input_wait_mask); | 2778 | FD_CLR (XINT (p->infd), &input_wait_mask); |
| 2773 | 2779 | ||
| 2774 | /* Tell wait_reading_process_input that it needs to wake up and | 2780 | /* Tell wait_reading_process_input that it needs to wake up and |
| 2775 | look around. */ | 2781 | look around. */ |
| @@ -2875,9 +2881,9 @@ status_notify () | |||
| 2875 | XSETINT (p->update_tick, XINT (p->tick)); | 2881 | XSETINT (p->update_tick, XINT (p->tick)); |
| 2876 | 2882 | ||
| 2877 | /* If process is still active, read any output that remains. */ | 2883 | /* If process is still active, read any output that remains. */ |
| 2878 | if (XFASTINT (p->infd)) | 2884 | if (XINT (p->infd) >= 0) |
| 2879 | while (! EQ (p->filter, Qt) | 2885 | while (! EQ (p->filter, Qt) |
| 2880 | && read_process_output (proc, XFASTINT (p->infd)) > 0); | 2886 | && read_process_output (proc, XINT (p->infd)) > 0); |
| 2881 | 2887 | ||
| 2882 | buffer = p->buffer; | 2888 | buffer = p->buffer; |
| 2883 | 2889 | ||