about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2012-01-06 02:26:04 +0100
committerAlexander Barton <alex@barton.de>2012-01-06 02:26:04 +0100
commitcc06e1ff89ae4b7ffc8d95a8ab1d9b6787a5d142 (patch)
tree999d23c154127aecc8491eb2cce908ad045b8701
parent9fbf592924d4ed1e37b42f295ec9c9ab0fc3cd08 (diff)
downloadngircd-cc06e1ff89ae4b7ffc8d95a8ab1d9b6787a5d142.tar.gz
ngircd-cc06e1ff89ae4b7ffc8d95a8ab1d9b6787a5d142.zip
Proc_Close(): Only close socket if it is still valid
It could be invalid when calling Proc_Close() a 2nd time, for exmaple,
which could happen when we hit a timeout doing IDENT requests :-(
-rw-r--r--src/ngircd/proc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ngircd/proc.c b/src/ngircd/proc.c
index 7addb47e..e062cd0b 100644
--- a/src/ngircd/proc.c
+++ b/src/ngircd/proc.c
@@ -154,7 +154,10 @@ Proc_Read(PROC_STAT *proc, void *buffer, size_t buflen)
 GLOBAL void
 Proc_Close(PROC_STAT *proc)
 {
-	io_close(proc->pipe_fd);
+	/* Close socket, if it exists */
+	if (proc->pipe_fd >= 0)
+		io_close(proc->pipe_fd);
+
 	Proc_InitStruct(proc);
 }