summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-06-19 03:03:08 +0000
committerRichard M. Stallman <rms@gnu.org>1997-06-19 03:03:08 +0000
commitdc867017e3925bc63c98d1e4c34f616279a7e44d (patch)
treec89d7882eb59df427a42c5ab3a06b378f02a4b88
parenta122b36e71021686bcc4fa9b3cd4a791fd677ef0 (diff)
downloademacs-dc867017e3925bc63c98d1e4c34f616279a7e44d.tar.gz
(Fprocess_send_eof): Use shutdown, if it's a socket.
Don't close the output descriptor if that is also the input descriptor.
-rw-r--r--src/process.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/process.c b/src/process.c
index 4ad8fe24af5..bed3e381d5e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3618,7 +3618,16 @@ text to PROCESS after you call this function.")
send_process (proc, "\004", 1, Qnil);
else
{
- close (XINT (XPROCESS (proc)->outfd));
+ /* If this is a network connection, or socketpair is used
+ for communication with the subprocess, call shutdown to cause EOF.
+ (In some old system, shutdown to socketpair doesn't work.
+ Then we just can't win.) */
+ if (NILP (XPROCESS (proc)->pid)
+ || XINT (XPROCESS (proc)->outfd) == XINT (XPROCESS (proc)->infd))
+ shutdown (XINT (XPROCESS (proc)->outfd), 1);
+ /* In case of socketpair, outfd == infd, so don't close it. */
+ if (XINT (XPROCESS (proc)->outfd) != XINT (XPROCESS (proc)->infd))
+ close (XINT (XPROCESS (proc)->outfd));
XSETINT (XPROCESS (proc)->outfd, open (NULL_DEVICE, O_WRONLY));
}
#endif /* VMS */