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
b6950530
Commit
b6950530
authored
Jan 06, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save a tons of sysconf() syscalls.
parent
68768d97
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
vsub.c
lib/libvarnish/vsub.c
+3
-2
No files found.
lib/libvarnish/vsub.c
View file @
b6950530
...
@@ -70,7 +70,7 @@ unsigned
...
@@ -70,7 +70,7 @@ unsigned
VSUB_run
(
struct
vsb
*
sb
,
vsub_func_f
*
func
,
void
*
priv
,
const
char
*
name
,
VSUB_run
(
struct
vsb
*
sb
,
vsub_func_f
*
func
,
void
*
priv
,
const
char
*
name
,
int
maxlines
)
int
maxlines
)
{
{
int
rv
,
p
[
2
],
sfd
,
status
;
int
rv
,
p
[
2
],
sfd
,
hfd
,
status
;
pid_t
pid
;
pid_t
pid
;
struct
vlu
*
vlu
;
struct
vlu
*
vlu
;
struct
vsub_priv
sp
;
struct
vsub_priv
sp
;
...
@@ -100,7 +100,8 @@ VSUB_run(struct vsb *sb, vsub_func_f *func, void *priv, const char *name,
...
@@ -100,7 +100,8 @@ VSUB_run(struct vsb *sb, vsub_func_f *func, void *priv, const char *name,
assert
(
dup2
(
p
[
1
],
STDOUT_FILENO
)
==
STDOUT_FILENO
);
assert
(
dup2
(
p
[
1
],
STDOUT_FILENO
)
==
STDOUT_FILENO
);
assert
(
dup2
(
p
[
1
],
STDERR_FILENO
)
==
STDERR_FILENO
);
assert
(
dup2
(
p
[
1
],
STDERR_FILENO
)
==
STDERR_FILENO
);
/* Close all other fds */
/* Close all other fds */
for
(
sfd
=
STDERR_FILENO
+
1
;
sfd
<
sysconf
(
_SC_OPEN_MAX
);
sfd
++
)
hfd
=
sysconf
(
_SC_OPEN_MAX
);
for
(
sfd
=
STDERR_FILENO
+
1
;
sfd
<
hfd
;
sfd
++
)
(
void
)
close
(
sfd
);
(
void
)
close
(
sfd
);
func
(
priv
);
func
(
priv
);
/*
/*
...
...
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