]> granicus.if.org Git - ngircd/commitdiff
Make Proc_Kill() more fault-tolerant
authorAlexander Barton <alex@barton.de>
Sun, 11 Jul 2010 14:54:44 +0000 (16:54 +0200)
committerAlexander Barton <alex@barton.de>
Sun, 11 Jul 2010 14:54:44 +0000 (16:54 +0200)
src/ngircd/proc.c

index 75c1aaf1a0ba6dbfbb2f7abdfd8c91e01c76c8cf..3eb3d8042edc0967bd19f1a7251a710850e4139d 100644 (file)
@@ -93,10 +93,11 @@ GLOBAL void
 Proc_Kill(PROC_STAT *proc)
 {
        assert(proc != NULL);
-       assert(proc->pipe_fd >= 0);
 
-       io_close(proc->pipe_fd);
-       kill(proc->pid, SIGTERM);
+       if (proc->pipe_fd > 0)
+               io_close(proc->pipe_fd);
+       if (proc->pid > 0)
+               kill(proc->pid, SIGTERM);
        Proc_InitStruct(proc);
 }