Use srand()/rand() instead of srandom()/random(); seems to be more portable
This commit is contained in:
parent
d99edb7728
commit
7f8d0ea5a3
|
@ -273,7 +273,7 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
|
||||||
|
|
||||||
#ifndef STRICT_RFC
|
#ifndef STRICT_RFC
|
||||||
if (Conf_AuthPing) {
|
if (Conf_AuthPing) {
|
||||||
Conn_SetAuthPing(Client_Conn(Client), random());
|
Conn_SetAuthPing(Client_Conn(Client), rand());
|
||||||
IRC_WriteStrClient(Client, "PING :%ld",
|
IRC_WriteStrClient(Client, "PING :%ld",
|
||||||
Conn_GetAuthPing(Client_Conn(Client)));
|
Conn_GetAuthPing(Client_Conn(Client)));
|
||||||
LogDebug("Connection %d: sent AUTH PING %ld ...",
|
LogDebug("Connection %d: sent AUTH PING %ld ...",
|
||||||
|
|
|
@ -576,13 +576,13 @@ Random_Init_Kern(const char *file)
|
||||||
if (read(fd, &seed, sizeof(seed)) == sizeof(seed))
|
if (read(fd, &seed, sizeof(seed)) == sizeof(seed))
|
||||||
ret = true;
|
ret = true;
|
||||||
close(fd);
|
close(fd);
|
||||||
srandom(seed);
|
srand(seed);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize libc random(3) number generator
|
* Initialize libc rand(3) number generator
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Random_Init(void)
|
Random_Init(void)
|
||||||
|
@ -593,7 +593,7 @@ Random_Init(void)
|
||||||
return;
|
return;
|
||||||
if (Random_Init_Kern("/dev/arandom"))
|
if (Random_Init_Kern("/dev/arandom"))
|
||||||
return;
|
return;
|
||||||
srandom(random() ^ getpid() ^ time(NULL));
|
srand(rand() ^ getpid() ^ time(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
seed = (unsigned int)random();
|
seed = (unsigned int)rand();
|
||||||
pid = fork();
|
pid = fork();
|
||||||
switch (pid) {
|
switch (pid) {
|
||||||
case -1:
|
case -1:
|
||||||
|
@ -73,7 +73,7 @@ Proc_Fork(PROC_STAT *proc, int *pipefds, void (*cbfunc)(int, short), int timeout
|
||||||
return -1;
|
return -1;
|
||||||
case 0:
|
case 0:
|
||||||
/* New child process: */
|
/* New child process: */
|
||||||
srandom(seed ^ (unsigned int)time(NULL) ^ getpid());
|
srand(seed ^ (unsigned int)time(NULL) ^ getpid());
|
||||||
Signals_Exit();
|
Signals_Exit();
|
||||||
signal(SIGTERM, Proc_GenericSignalHandler);
|
signal(SIGTERM, Proc_GenericSignalHandler);
|
||||||
signal(SIGALRM, Proc_GenericSignalHandler);
|
signal(SIGALRM, Proc_GenericSignalHandler);
|
||||||
|
|
Loading…
Reference in New Issue