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
64370e2f
Commit
64370e2f
authored
Jan 14, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use closefd() throughout
parent
0a105cdd
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
27 additions
and
27 deletions
+27
-27
cache_acceptor.c
bin/varnishd/cache/cache_acceptor.c
+2
-2
cache_vrt_vmod.c
bin/varnishd/cache/cache_vrt_vmod.c
+3
-3
mgt_acceptor.c
bin/varnishd/mgt/mgt_acceptor.c
+1
-1
mgt_cli.c
bin/varnishd/mgt/mgt_cli.c
+2
-2
mgt_jail.c
bin/varnishd/mgt/mgt_jail.c
+1
-1
mgt_main.c
bin/varnishd/mgt/mgt_main.c
+5
-5
mgt_param_tcp.c
bin/varnishd/mgt/mgt_param_tcp.c
+1
-1
mgt_shmem.c
bin/varnishd/mgt/mgt_shmem.c
+1
-1
mgt_vcc.c
bin/varnishd/mgt/mgt_vcc.c
+2
-2
cache_waiter_epoll.c
bin/varnishd/waiter/cache_waiter_epoll.c
+3
-3
cache_waiter_kqueue.c
bin/varnishd/waiter/cache_waiter_kqueue.c
+3
-3
cache_waiter_poll.c
bin/varnishd/waiter/cache_waiter_poll.c
+2
-2
cache_waiter_ports.c
bin/varnishd/waiter/cache_waiter_ports.c
+1
-1
No files found.
bin/varnishd/cache/cache_acceptor.c
View file @
64370e2f
...
...
@@ -305,7 +305,7 @@ vca_make_session(struct worker *wrk, void *arg)
CAST_OBJ_NOTNULL
(
wa
,
arg
,
WRK_ACCEPT_MAGIC
);
if
(
VTCP_blocking
(
wa
->
acceptsock
))
{
AZ
(
close
(
wa
->
acceptsock
)
);
closefd
(
&
wa
->
acceptsock
);
wrk
->
stats
->
sess_drop
++
;
// XXX Better counter ?
WS_Release
(
wrk
->
aws
,
0
);
return
;
...
...
@@ -322,7 +322,7 @@ vca_make_session(struct worker *wrk, void *arg)
*/
vca_pace_bad
();
(
void
)
VTCP_nonblocking
(
wa
->
acceptsock
);
AZ
(
close
(
wa
->
acceptsock
)
);
closefd
(
&
wa
->
acceptsock
);
wrk
->
stats
->
sess_drop
++
;
WS_Release
(
wrk
->
aws
,
0
);
return
;
...
...
bin/varnishd/cache/cache_vrt_vmod.c
View file @
64370e2f
...
...
@@ -86,7 +86,7 @@ vrt_vmod_backup_copy(VRT_CTX, const char *nm, const char *fm, const char *to)
VSB_printf
(
ctx
->
msg
,
"Opening vmod %s from %s: %s
\n
"
,
nm
,
fm
,
strerror
(
errno
));
AZ
(
unlink
(
to
));
AZ
(
close
(
fo
)
);
closefd
(
&
fo
);
return
(
1
);
}
while
(
1
)
{
...
...
@@ -101,8 +101,8 @@ vrt_vmod_backup_copy(VRT_CTX, const char *nm, const char *fm, const char *to)
break
;
}
}
AZ
(
close
(
fi
)
);
AZ
(
close
(
fo
)
);
closefd
(
&
fi
);
closefd
(
&
fo
);
return
(
ret
);
}
...
...
bin/varnishd/mgt/mgt_acceptor.c
View file @
64370e2f
...
...
@@ -59,7 +59,7 @@ mac_opensocket(struct listen_sock *ls)
CHECK_OBJ_NOTNULL
(
ls
,
LISTEN_SOCK_MAGIC
);
if
(
ls
->
sock
>
0
)
{
MCH_Fd_Inherit
(
ls
->
sock
,
NULL
);
AZ
(
close
(
ls
->
sock
)
);
closefd
(
&
ls
->
sock
);
}
ls
->
sock
=
VTCP_bind
(
ls
->
addr
,
NULL
);
fail
=
errno
;
...
...
bin/varnishd/mgt/mgt_cli.c
View file @
64370e2f
...
...
@@ -282,7 +282,7 @@ mcf_auth(struct cli *cli, const char *const *av, void *priv)
VJ_master
(
JAIL_MASTER_LOW
);
MCH_TrackHighFd
(
fd
);
VCLI_AuthResponse
(
fd
,
cli
->
challenge
,
buf
);
AZ
(
close
(
fd
)
);
closefd
(
&
fd
);
if
(
strcasecmp
(
buf
,
av
[
2
]))
{
MGT_Complain
(
C_SECURITY
,
"CLI Authentication failure from %s"
,
cli
->
ident
);
...
...
@@ -518,7 +518,7 @@ mgt_cli_secret(const char *S_arg)
fprintf
(
stderr
,
"Can not read secret-file
\"
%s
\"\n
"
,
S_arg
);
exit
(
2
);
}
AZ
(
close
(
fd
)
);
closefd
(
&
fd
);
secret_file
=
S_arg
;
}
...
...
bin/varnishd/mgt/mgt_jail.c
View file @
64370e2f
...
...
@@ -156,7 +156,7 @@ VJ_make_workdir(const char *dname)
ARGV_ERR
(
"Cannot create test-file in %s (%s)
\n
"
"Check permissions (or delete old directory)
\n
"
,
dname
,
strerror
(
errno
));
AZ
(
close
(
fd
)
);
closefd
(
&
fd
);
AZ
(
unlink
(
"_.testfile"
));
VJ_master
(
JAIL_MASTER_LOW
);
return
(
0
);
...
...
bin/varnishd/mgt/mgt_main.c
View file @
64370e2f
...
...
@@ -219,7 +219,7 @@ make_secret(const char *dirname)
AZ
(
VRND_RandomCrypto
(
&
b
,
1
));
assert
(
1
==
write
(
fdo
,
&
b
,
1
));
}
AZ
(
close
(
fdo
)
);
closefd
(
&
fdo
);
VJ_master
(
JAIL_MASTER_LOW
);
AZ
(
atexit
(
mgt_secret_atexit
));
return
(
fn
);
...
...
@@ -361,7 +361,7 @@ mgt_eric(void)
fprintf
(
stderr
,
"Fork() failed: %s
\n
"
,
strerror
(
errno
));
exit
(
-
1
);
case
0
:
AZ
(
close
(
eric_pipes
[
0
])
);
closefd
(
&
eric_pipes
[
0
]
);
assert
(
setsid
()
>
1
);
VFIL_null_fd
(
STDIN_FILENO
);
...
...
@@ -369,7 +369,7 @@ mgt_eric(void)
default:
break
;
}
AZ
(
close
(
eric_pipes
[
1
])
);
closefd
(
&
eric_pipes
[
1
]
);
sz
=
read
(
eric_pipes
[
0
],
&
u
,
sizeof
u
);
if
(
sz
==
sizeof
u
&&
u
==
ERIC_MAGIC
)
exit
(
0
);
...
...
@@ -391,7 +391,7 @@ mgt_eric_im_done(int eric_fd, unsigned u)
VFIL_null_fd
(
STDERR_FILENO
);
assert
(
write
(
eric_fd
,
&
u
,
sizeof
u
)
==
sizeof
u
);
AZ
(
close
(
eric_fd
)
);
closefd
(
&
eric_fd
);
}
/*--------------------------------------------------------------------*/
...
...
@@ -681,7 +681,7 @@ main(int argc, char * const *argv)
if
(
o
<
0
)
ARGV_ERR
(
"Cannot open -S file (%s): %s
\n
"
,
S_arg
,
strerror
(
errno
));
AZ
(
close
(
o
)
);
closefd
(
&
o
);
VJ_master
(
JAIL_MASTER_LOW
);
}
...
...
bin/varnishd/mgt/mgt_param_tcp.c
View file @
64370e2f
...
...
@@ -75,7 +75,7 @@ tcp_keep_probes(void)
tcp_probe
(
s
,
TCP_KEEPIDLE
,
"tcp_keepalive_time"
,
600
);
tcp_probe
(
s
,
TCP_KEEPCNT
,
"tcp_keepalive_probes"
,
5
);
tcp_probe
(
s
,
TCP_KEEPINTVL
,
"tcp_keepalive_intvl"
,
5
);
AZ
(
close
(
s
)
);
closefd
(
&
s
);
}
#endif
...
...
bin/varnishd/mgt/mgt_shmem.c
View file @
64370e2f
...
...
@@ -218,7 +218,7 @@ mgt_SHM_Create(void)
MAP_HASSEMAPHORE
|
MAP_NOSYNC
|
MAP_SHARED
,
vsm_fd
,
0
);
AZ
(
close
(
vsm_fd
)
);
closefd
(
&
vsm_fd
);
if
(
p
==
MAP_FAILED
)
{
MGT_Complain
(
C_ERR
,
"Mmap error %s: %s"
,
...
...
bin/varnishd/mgt/mgt_vcc.c
View file @
64370e2f
...
...
@@ -125,7 +125,7 @@ run_vcc(void *priv)
fprintf
(
stderr
,
"VCC cannot write %s"
,
vp
->
csrcfile
);
exit
(
2
);
}
AZ
(
close
(
fd
)
);
closefd
(
&
fd
);
VSB_destroy
(
&
csrc
);
exit
(
0
);
}
...
...
@@ -216,7 +216,7 @@ mgt_vcc_touchfile(const char *fn, struct vsb *sb)
if
(
geteuid
()
==
0
)
VSB_printf
(
sb
,
"Failed to change owner on %s: %s
\n
"
,
fn
,
strerror
(
errno
));
AZ
(
close
(
i
)
);
closefd
(
&
i
);
return
(
0
);
}
...
...
bin/varnishd/waiter/cache_waiter_epoll.c
View file @
64370e2f
...
...
@@ -146,9 +146,9 @@ vwe_thread(void *priv)
if
(
vwe
->
nwaited
==
0
&&
vwe
->
die
)
break
;
}
AZ
(
close
(
vwe
->
pipe
[
0
])
);
AZ
(
close
(
vwe
->
pipe
[
1
])
);
AZ
(
close
(
vwe
->
epfd
)
);
closefd
(
&
vwe
->
pipe
[
0
]
);
closefd
(
&
vwe
->
pipe
[
1
]
);
closefd
(
&
vwe
->
epfd
);
return
(
NULL
);
}
...
...
bin/varnishd/waiter/cache_waiter_kqueue.c
View file @
64370e2f
...
...
@@ -128,9 +128,9 @@ vwk_thread(void *priv)
if
(
vwk
->
nwaited
==
0
&&
vwk
->
die
)
break
;
}
AZ
(
close
(
vwk
->
pipe
[
0
])
);
AZ
(
close
(
vwk
->
pipe
[
1
])
);
AZ
(
close
(
vwk
->
kq
)
);
closefd
(
&
vwk
->
pipe
[
0
]
);
closefd
(
&
vwk
->
pipe
[
1
]
);
closefd
(
&
vwk
->
kq
);
return
(
NULL
);
}
...
...
bin/varnishd/waiter/cache_waiter_poll.c
View file @
64370e2f
...
...
@@ -262,8 +262,8 @@ vwp_fini(struct waiter *w)
// XXX: set write pipe blocking
assert
(
write
(
vwp
->
pipes
[
1
],
&
vp
,
sizeof
vp
)
==
sizeof
vp
);
AZ
(
pthread_join
(
vwp
->
thread
,
&
vp
));
AZ
(
close
(
vwp
->
pipes
[
0
])
);
AZ
(
close
(
vwp
->
pipes
[
1
])
);
closefd
(
&
vwp
->
pipes
[
0
]
);
closefd
(
&
vwp
->
pipes
[
1
]
);
free
(
vwp
->
pollfd
);
free
(
vwp
->
idx
);
}
...
...
bin/varnishd/waiter/cache_waiter_ports.c
View file @
64370e2f
...
...
@@ -256,7 +256,7 @@ vws_fini(struct waiter *w)
CAST_OBJ_NOTNULL
(
vws
,
w
->
priv
,
VWS_MAGIC
);
vws
->
die
=
1
;
AZ
(
close
(
vws
->
dport
)
);
closefd
(
&
vws
->
dport
);
AZ
(
pthread_join
(
vws
->
thread
,
&
vp
));
}
...
...
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