Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
39249ece
Commit
39249ece
authored
Jul 15, 2011
by
Tollef Fog Heen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fall back to using current time if urandom is not available
parent
61b0dcfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
vtmpfile.c
lib/libvarnish/vtmpfile.c
+7
-2
No files found.
lib/libvarnish/vtmpfile.c
View file @
39249ece
...
...
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <sys/stat.h>
...
...
@@ -47,8 +48,12 @@ seed_random(void)
unsigned
seed
;
fd
=
open
(
"/dev/urandom"
,
O_RDONLY
);
if
(
fd
==
-
1
)
return
(
1
);
if
(
fd
==
-
1
)
{
/* urandom not available, fall back to something
* weaker */
srandom
(
time
(
NULL
));
return
(
0
);
}
if
(
read
(
fd
,
&
seed
,
sizeof
seed
)
!=
sizeof
seed
)
return
(
1
);
(
void
)
close
(
fd
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment