mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
srand*dev() fallback code: change ^getpid() to ^(getpid() << 16) to allow
change of high word part too to produce more interesting seed distribution.
This commit is contained in:
parent
931c04f1a8
commit
848422bb7d
2 changed files with 2 additions and 2 deletions
|
|
@ -130,7 +130,7 @@ sranddev()
|
|||
unsigned long junk;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
next = getpid() ^ tv.tv_sec ^ tv.tv_usec ^ junk;
|
||||
next = (getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ srandomdev()
|
|||
unsigned long junk;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
srandom(getpid() ^ tv.tv_sec ^ tv.tv_usec ^ junk);
|
||||
srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue