]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Proc_Close(): Only close socket if it is still valid
authorAlexander Barton <alex@barton.de>
Fri, 6 Jan 2012 01:26:04 +0000 (02:26 +0100)
committerAlexander Barton <alex@barton.de>
Fri, 6 Jan 2012 01:26:04 +0000 (02:26 +0100)
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

index 7addb47ef30c804e889b6a49d390e2505ae8e1b2..e062cd0b7c702494a3992e8bfe1beab2a348113a 100644 (file)
@@ -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);
 }