Module: ngircd.git Branch: master Commit: cc06e1ff89ae4b7ffc8d95a8ab1d9b6787a5d142 URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=cc06e...
Author: Alexander Barton alex@barton.de Date: Fri Jan 6 02:26:04 2012 +0100
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 :-(
---
src/ngircd/proc.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/ngircd/proc.c b/src/ngircd/proc.c index 7addb47..e062cd0 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); }