]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/proc.c
PAM: don't use global password buffer for conv struct
[ngircd-alex.git] / src / ngircd / proc.c
index 2a5eda8304ea1c462612329118dbd698b00148c6..7addb47ef30c804e889b6a49d390e2505ae8e1b2 100644 (file)
@@ -79,7 +79,6 @@ Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout
                signal(SIGALRM, Proc_GenericSignalHandler);
                close(pipefds[0]);
                alarm(timeout);
-               Conn_CloseAllSockets();
                return 0;
        }
 
@@ -138,13 +137,14 @@ Proc_Read(PROC_STAT *proc, void *buffer, size_t buflen)
                        return 0;
                Log(LOG_CRIT, "Can't read from child process %ld: %s",
                    proc->pid, strerror(errno));
+               Proc_Close(proc);
                bytes_read = 0;
+       } else if (bytes_read == 0) {
+               /* EOF: clean up */
+               LogDebug("Child process %ld: EOF reached, closing pipe.",
+                        proc->pid);
+               Proc_Close(proc);
        }
-#if DEBUG
-       else if (bytes_read == 0)
-               LogDebug("Can't read from child process %ld: EOF", proc->pid);
-#endif
-       Proc_InitStruct(proc);
        return (size_t)bytes_read;
 }