[master] d63c53e Squash warnings for warn_unused_result.
Lasse Karstensen
lkarsten at varnish-software.com
Thu Sep 4 13:00:04 CEST 2014
commit d63c53e803b0022f43ead1d25acd64e0fad39949
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date: Thu Sep 4 12:56:47 2014 +0200
Squash warnings for warn_unused_result.
diff --git a/lib/libvarnish/vlu.c b/lib/libvarnish/vlu.c
index 610ca8b..5498f11 100644
--- a/lib/libvarnish/vlu.c
+++ b/lib/libvarnish/vlu.c
@@ -96,6 +96,7 @@ vlu_dotelnet(struct vlu *l, char *p)
char *e;
char tno[3];
int i;
+ ssize_t r = 0;
e = l->buf + l->bufp;
assert(p >= l->buf && p < e);
@@ -120,7 +121,9 @@ vlu_dotelnet(struct vlu *l, char *p)
/* Return WONT for these */
memcpy(tno, p, 3);
tno[1] = (char)252;
- (void)write(l->telnet, tno, 3);
+ r = write(l->telnet, tno, 3);
+ if (r != 3)
+ return (1);
i = 3;
break;
default:
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 6e0f20a..7319253 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -408,6 +408,7 @@ VSL_WriteOpen(struct VSL_data *vsl, const char *name, int append, int unbuf)
{
const char head[] = VSL_FILE_ID;
FILE* f;
+ size_t r = 0;
f = fopen(name, append ? "a" : "w");
if (f == NULL) {
@@ -417,7 +418,12 @@ VSL_WriteOpen(struct VSL_data *vsl, const char *name, int append, int unbuf)
if (unbuf)
setbuf(f, NULL);
if (0 == ftell(f))
- fwrite(head, 1, sizeof head, f);
+ r = fwrite(head, 1, sizeof head, f);
+ if (r != sizeof head) {
+ vsl_diag(vsl, "%s", strerror(errno));
+ fclose(f);
+ return (NULL);
+ }
return (f);
}
More information about the varnish-commit
mailing list