]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/proc.c
Remove imp.h and exp.h header files
[ngircd-alex.git] / src / ngircd / proc.c
index e062cd0b7c702494a3992e8bfe1beab2a348113a..4220f1ab16f9101550e40df8e351caa777545b21 100644 (file)
@@ -16,7 +16,6 @@
  * Process management
  */
 
-#include "imp.h"
 #include <assert.h>
 #include <errno.h>
 #include <signal.h>
@@ -27,8 +26,6 @@
 #include "log.h"
 #include "io.h"
 #include "conn.h"
-
-#include "exp.h"
 #include "sighandlers.h"
 #include "proc.h"
 
@@ -50,7 +47,9 @@ GLOBAL pid_t
 Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout)
 {
        pid_t pid;
+#ifndef HAVE_ARC4RANDOM
        unsigned int seed;
+#endif
 
        assert(proc != NULL);
        assert(pipefds != NULL);
@@ -62,7 +61,9 @@ Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout
                return -1;
        }
 
+#ifndef HAVE_ARC4RANDOM
        seed = (unsigned int)rand();
+#endif
        pid = fork();
        switch (pid) {
        case -1:
@@ -73,7 +74,12 @@ Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout
                return -1;
        case 0:
                /* New child process: */
+#ifdef HAVE_ARC4RANDOM_STIR
+               arc4random_stir();
+#endif
+#ifndef HAVE_ARC4RANDOM
                srand(seed ^ (unsigned int)time(NULL) ^ getpid());
+#endif
                Signals_Exit();
                signal(SIGTERM, Proc_GenericSignalHandler);
                signal(SIGALRM, Proc_GenericSignalHandler);