Commit 43ade053 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Assert return values of system{calls,functions}


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2025 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 2f6b07ba
......@@ -92,7 +92,7 @@ VBE_TryConnect(const struct sess *sp, const struct addrinfo *ai)
}
if (connect(s, (void *)&ss, alen) != 0) {
close(s);
AZ(close(s));
LOCK(&sp->backend->mtx);
return (-1);
}
......
......@@ -257,7 +257,7 @@ bes_GetFd(struct sess *sp)
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 @@ bes_Cleanup(struct backend *b)
break;
TAILQ_REMOVE(&bes->connlist, vbe, list);
if (vbe->fd >= 0)
close(vbe->fd);
AZ(close(vbe->fd));
FREE_OBJ(vbe);
}
FREE_OBJ(bes);
......
......@@ -175,7 +175,7 @@ exp_prefetch(void *arg)
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) {
......
......@@ -50,16 +50,16 @@ rdf(struct pollfd *fds, int idx)
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;
}
......
......@@ -345,14 +345,14 @@ mgt_cli_callback(struct ev *e, int what)
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);
......
......@@ -173,8 +173,8 @@ mgt_CallCc(const char *source, struct vsb *sb)
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 @@ mgt_CallCc(const char *source, struct vsb *sb)
"\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 @@ mgt_CallCc(const char *source, struct vsb *sb)
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 @@ mgt_CallCc(const char *source, struct vsb *sb)
/* 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 @@ mgt_CallCc(const char *source, struct vsb *sb)
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 @@ mgt_vcc_add(const char *name, char *file)
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment