[master] 6db7d75 Use closefd() throughout, take 2
Poul-Henning Kamp
phk at phk.freebsd.dk
Tue Feb 21 15:37:37 CET 2017
--------
In message <E1cgA8r-0000zX-GS at project.varnish-software.com>, Dridi Boukelmoune
writes:
> This patch was created using Coccinelle and the following steps:
>
> $ cat >closefd.cocci <<EOF
> @@
> expression fd;
> @@
>
> - AZ(close(fd));
> + closefd(&fd);
> EOF
> $ spatch --dir . --in-place --sp-file closefd.cocci
So I'm all for tools, but the resulting changes shouls always be
stared at manually to catch stuff like this:
>@@ -482,12 +482,12 @@ varnish_launch(struct varnish *v)
> vtc_fatal(v->vl, "FAIL CLI connection wait failure");
> nfd = accept(v->cli_fd, NULL, NULL);
> if (nfd < 0) {
>- AZ(close(v->cli_fd));
>+ closefd(&v->cli_fd);
> v->cli_fd = -1;
> vtc_fatal(v->vl, "FAIL no CLI connection accepted");
> }
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the varnish-commit
mailing list