]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Add some type casts to random() and srandom() functions
authorAlexander Barton <alex@barton.de>
Tue, 12 Apr 2011 19:23:14 +0000 (21:23 +0200)
committerAlexander Barton <alex@barton.de>
Tue, 12 Apr 2011 19:23:14 +0000 (21:23 +0200)
This fixes two gcc warnings (on Mac OS X):
 "warning: implicit conversion shortens 64-bit value into a 32-bit value"

src/ngircd/proc.c

index 557543c26c2385941b3c0ce8f75031398d66f0e8..217eb6d3ba17a3d22613caabfb2662e6c9f4cccc 100644 (file)
@@ -62,7 +62,7 @@ Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout
                return -1;
        }
 
-       seed = random();
+       seed = (unsigned int)random();
        pid = fork();
        switch (pid) {
        case -1:
@@ -73,7 +73,7 @@ Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout
                return -1;
        case 0:
                /* New child process: */
-               srandom(seed ^ time(NULL) ^ getpid());
+               srandom(seed ^ (unsigned int)time(NULL) ^ getpid());
                Signals_Exit();
                signal(SIGTERM, Proc_GenericSignalHandler);
                signal(SIGALRM, Proc_GenericSignalHandler);