diff options
Diffstat (limited to 'src/process.c')
-rw-r--r-- | src/process.c | 68 |
1 files changed, 50 insertions, 18 deletions
diff --git a/src/process.c b/src/process.c index 71da2e17670..206af7059fb 100644 --- a/src/process.c +++ b/src/process.c @@ -1408,7 +1408,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) val = XCDR (Vdefault_process_coding_system); } XPROCESS (proc)->encode_coding_system = val; - /* Note: At this momemnt, the above coding system may leave + /* Note: At this moment, the above coding system may leave text-conversion or eol-conversion unspecified. They will be decided after we read output from the process and decode it by some coding system, or just before we actually send a text to @@ -1515,8 +1515,9 @@ start_process_unwind (Lisp_Object proc) if (!PROCESSP (proc)) abort (); - /* Was PROC started successfully? */ - if (XPROCESS (proc)->pid == -1) + /* Was PROC started successfully? + -2 is used for a pty with no process, eg for gdb. */ + if (XPROCESS (proc)->pid <= 0 && XPROCESS (proc)->pid != -2) remove_process (proc); return Qnil; @@ -3470,7 +3471,7 @@ usage: (make-network-process &rest ARGS) */) { /* Setup coding systems for communicating with the network stream. */ - struct gcpro inner_gcpro1; + struct gcpro gcpro1; /* Qt denotes we have not yet called Ffind_operation_coding_system. */ Lisp_Object coding_systems = Qt; Lisp_Object fargs[5], val; @@ -3498,9 +3499,9 @@ usage: (make-network-process &rest ARGS) */) { fargs[0] = Qopen_network_stream, fargs[1] = name, fargs[2] = buffer, fargs[3] = host, fargs[4] = service; - GCPRO1_VAR (proc, inner_gcpro); + GCPRO1 (proc); coding_systems = Ffind_operation_coding_system (5, fargs); - UNGCPRO_VAR (inner_gcpro); + UNGCPRO; } if (CONSP (coding_systems)) val = XCAR (coding_systems); @@ -3531,9 +3532,9 @@ usage: (make-network-process &rest ARGS) */) { fargs[0] = Qopen_network_stream, fargs[1] = name, fargs[2] = buffer, fargs[3] = host, fargs[4] = service; - GCPRO1_VAR (proc, inner_gcpro); + GCPRO1 (proc); coding_systems = Ffind_operation_coding_system (5, fargs); - UNGCPRO_VAR (inner_gcpro); + UNGCPRO; } } if (CONSP (coding_systems)) @@ -3713,7 +3714,7 @@ DEFUN ("network-interface-info", Fnetwork_interface_info, Snetwork_interface_inf doc: /* Return information about network interface named IFNAME. The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, -NETMASK is the layer 3 network mask, HWADDR is the layer 2 addres, and +NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and FLAGS is the current flags of the interface. */) (Lisp_Object ifname) { @@ -4606,15 +4607,46 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, some data in the TCP buffers so that select works, but with custom pull/push functions we need to check if some data is available in the buffers manually. */ - if (nfds == 0 && - wait_proc && wait_proc->gnutls_p /* Check for valid process. */ - /* Do we have pending data? */ - && emacs_gnutls_record_check_pending (wait_proc->gnutls_state) > 0) - { - nfds = 1; - /* Set to Available. */ - FD_SET (wait_proc->infd, &Available); - } + if (nfds == 0) + { + if (! wait_proc) + { + /* We're not waiting on a specific process, so loop + through all the channels and check for data. + This is a workaround needed for some versions of + the gnutls library -- 2.12.14 has been confirmed + to need it. See + http://comments.gmane.org/gmane.emacs.devel/145074 */ + for (channel = 0; channel < MAXDESC; ++channel) + if (! NILP (chan_process[channel])) + { + struct Lisp_Process *p = + XPROCESS (chan_process[channel]); + if (p && p->gnutls_p && p->infd + && ((emacs_gnutls_record_check_pending + (p->gnutls_state)) + > 0)) + { + nfds++; + FD_SET (p->infd, &Available); + } + } + } + else + { + /* Check this specific channel. */ + if (wait_proc->gnutls_p /* Check for valid process. */ + /* Do we have pending data? */ + && ((emacs_gnutls_record_check_pending + (wait_proc->gnutls_state)) + > 0)) + { + nfds = 1; + /* Set to Available. */ + FD_SET (wait_proc->infd, &Available); + } + } + } #endif } |