Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishevent3
Commits
939d2299
Commit
939d2299
authored
Jun 10, 2011
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Seed random() on startup from /dev/urandom so vtmpfile actually
returns random file names
parent
d81cc9b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
varnishd.c
bin/varnishd/varnishd.c
+2
-0
libvarnish.h
include/libvarnish.h
+1
-0
vtmpfile.c
lib/libvarnish/vtmpfile.c
+16
-0
No files found.
bin/varnishd/varnishd.c
View file @
939d2299
...
...
@@ -364,6 +364,8 @@ main(int argc, char * const *argv)
for
(
o
=
getdtablesize
();
o
>
STDERR_FILENO
;
o
--
)
(
void
)
close
(
o
);
AZ
(
seed_random
());
mgt_got_fd
(
STDERR_FILENO
);
setbuf
(
stdout
,
NULL
);
...
...
include/libvarnish.h
View file @
939d2299
...
...
@@ -99,6 +99,7 @@ struct timeval TIM_timeval(double t);
void
VCS_Message
(
const
char
*
);
/* from libvarnish/vtmpfile.c */
int
seed_random
(
void
);
int
vtmpfile
(
char
*
);
char
*
vreadfile
(
const
char
*
pfx
,
const
char
*
fn
,
ssize_t
*
sz
);
char
*
vreadfd
(
int
fd
,
ssize_t
*
sz
);
...
...
lib/libvarnish/vtmpfile.c
View file @
939d2299
...
...
@@ -40,6 +40,22 @@
#include "libvarnish.h"
int
seed_random
(
void
)
{
int
fd
;
unsigned
seed
;
fd
=
open
(
"/dev/urandom"
,
O_RDONLY
);
if
(
fd
==
-
1
)
return
(
1
);
if
(
read
(
fd
,
&
seed
,
sizeof
seed
)
!=
sizeof
seed
)
return
(
1
);
(
void
)
close
(
fd
);
srandom
(
seed
);
return
(
0
);
}
int
vtmpfile
(
char
*
template
)
{
...
...
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