r2025 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Tue Sep 25 09:30:38 CEST 2007
Author: phk
Date: 2007-09-25 09:30:38 +0200 (Tue, 25 Sep 2007)
New Revision: 2025
Modified:
trunk/varnish-cache/bin/varnishd/cache_backend.c
trunk/varnish-cache/bin/varnishd/cache_backend_simple.c
trunk/varnish-cache/bin/varnishd/cache_expire.c
trunk/varnish-cache/bin/varnishd/cache_pipe.c
trunk/varnish-cache/bin/varnishd/mgt_cli.c
trunk/varnish-cache/bin/varnishd/mgt_vcc.c
Log:
Assert return values of system{calls,functions}
Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c 2007-09-25 07:22:58 UTC (rev 2024)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2007-09-25 07:30:38 UTC (rev 2025)
@@ -92,7 +92,7 @@
}
if (connect(s, (void *)&ss, alen) != 0) {
- close(s);
+ AZ(close(s));
LOCK(&sp->backend->mtx);
return (-1);
}
Modified: trunk/varnish-cache/bin/varnishd/cache_backend_simple.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend_simple.c 2007-09-25 07:22:58 UTC (rev 2024)
+++ trunk/varnish-cache/bin/varnishd/cache_backend_simple.c 2007-09-25 07:30:38 UTC (rev 2025)
@@ -257,7 +257,7 @@
for (n = 1; n < 5; n++) {
vc = bes_nextfd(sp);
if (vc == NULL) {
- usleep(100000 * n);
+ AZ(usleep(100000 * n));
continue;
}
assert(vc->fd >= 0);
@@ -325,7 +325,7 @@
break;
TAILQ_REMOVE(&bes->connlist, vbe, list);
if (vbe->fd >= 0)
- close(vbe->fd);
+ AZ(close(vbe->fd));
FREE_OBJ(vbe);
}
FREE_OBJ(bes);
Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c 2007-09-25 07:22:58 UTC (rev 2024)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2007-09-25 07:30:38 UTC (rev 2025)
@@ -175,7 +175,7 @@
ww.wlp = ww.wlog;
ww.wle = ww.wlog + sizeof ww.wlog;
- sleep(10); /* Takes time for VCL to arrive */
+ AZ(sleep(10)); /* XXX: Takes time for VCL to arrive */
VCL_Get(&sp->vcl);
t = TIM_real();
while (1) {
Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2007-09-25 07:22:58 UTC (rev 2024)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2007-09-25 07:30:38 UTC (rev 2025)
@@ -50,16 +50,16 @@
i = read(fds[idx].fd, buf, sizeof buf);
if (i <= 0 || fds[1-idx].events == 0) {
- shutdown(fds[idx].fd, SHUT_RD);
- shutdown(fds[1-idx].fd, SHUT_WR);
+ AZ(shutdown(fds[idx].fd, SHUT_RD));
+ AZ(shutdown(fds[1-idx].fd, SHUT_WR));
fds[idx].events = 0;
return;
}
for (p = buf; i > 0; i -= j, p += j) {
j = write(fds[1-idx].fd, p, i);
if (j != i) {
- shutdown(fds[idx].fd, SHUT_WR);
- shutdown(fds[1-idx].fd, SHUT_RD);
+ AZ(shutdown(fds[idx].fd, SHUT_WR));
+ AZ(shutdown(fds[1-idx].fd, SHUT_RD));
fds[1-idx].events = 0;
return;
}
Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2007-09-25 07:22:58 UTC (rev 2024)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2007-09-25 07:30:38 UTC (rev 2025)
@@ -345,14 +345,14 @@
cli_close:
vsb_delete(cp->cli->sb);
free(cp->buf);
- close(cp->fdi);
+ AZ(close(cp->fdi));
if (cp->fdi == 0)
- open("/dev/null", O_RDONLY);
- close(cp->fdo);
+ assert(open("/dev/null", O_RDONLY) == 0);
+ AZ(close(cp->fdo));
if (cp->fdo == 1) {
+ assert(open("/dev/null", O_WRONLY) == 1);
close(2);
- open("/dev/null", O_WRONLY);
- open("/dev/null", O_WRONLY);
+ assert(open("/dev/null", O_WRONLY) == 2);
}
free(cp);
return (1);
Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2007-09-25 07:22:58 UTC (rev 2024)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2007-09-25 07:30:38 UTC (rev 2025)
@@ -173,8 +173,8 @@
vsb_printf(sb,
"Write error to C source file: %s\n",
strerror(errno));
- unlink(sf);
- fclose(fs);
+ AZ(unlink(sf));
+ AZ(fclose(fs));
return (NULL);
}
rewind(fs);
@@ -216,8 +216,8 @@
"\tcommand attempted: %s\n",
strerror(errno), vsb_data(cccmd));
free(of);
- unlink(sf);
- fclose(fs);
+ AZ(unlink(sf));
+ AZ(fclose(fs));
vsb_delete(cccmd);
return (NULL);
}
@@ -241,8 +241,8 @@
i = pclose(fo);
- unlink(sf);
- fclose(fs);
+ AZ(unlink(sf));
+ AZ(fclose(fs));
if (j == 0 && i != 0) {
vsb_printf(sb,
@@ -262,7 +262,7 @@
/* If the compiler complained, or exited non-zero, fail */
if (i || j) {
- unlink(of);
+ AZ(unlink(of));
free(of);
return (NULL);
}
@@ -272,12 +272,12 @@
if (p == NULL) {
vsb_printf(sb, "Problem loading compiled VCL program:\n\t%s\n",
dlerror());
- unlink(of);
+ AZ(unlink(of));
free(of);
return (NULL);
}
- (void)dlclose(p);
+ AZ(dlclose(p));
return (of);
}
@@ -328,6 +328,7 @@
vp = calloc(sizeof *vp, 1);
XXXAN(vp);
vp->name = strdup(name);
+ XXXAN(vp->name);
vp->fname = file;
TAILQ_INSERT_TAIL(&vclhead, vp, list);
return (vp);
More information about the varnish-commit
mailing list