diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-03-21 04:44:20 (JST) |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-03-21 05:08:32 (JST) |
commit | 6d7e3596ebb387265d8cfdc5b312e0ea76da8c8a (patch) | |
tree | e160033edb9a9077b077c7cf2d6d65f8856d6643 | |
parent | 40e1d9b6177558bf4069c09ca6d8e3a682baa988 (diff) | |
download | cgit-6d7e3596ebb387265d8cfdc5b312e0ea76da8c8a.zip cgit-6d7e3596ebb387265d8cfdc5b312e0ea76da8c8a.tar.gz |
html: check return value of write
This squelches a gcc warning. It's also correct that we check to see if
there are any partial or failed writes. For now, we just print a warning
to stderr. In the future, perhaps it will prove wise to exit(1) on
partial writes.
-rw-r--r-- | html.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -63,12 +63,13 @@ char *fmt(const char *format, ...) | |||
63 | 63 | ||
64 | void html_raw(const char *data, size_t size) | 64 | void html_raw(const char *data, size_t size) |
65 | { | 65 | { |
66 | write(htmlfd, data, size); | 66 | if (write(htmlfd, data, size) != size) |
67 | fprintf(stderr, "[html.c] html output truncated.\n"); | ||
67 | } | 68 | } |
68 | 69 | ||
69 | void html(const char *txt) | 70 | void html(const char *txt) |
70 | { | 71 | { |
71 | write(htmlfd, txt, strlen(txt)); | 72 | html_raw(txt, strlen(txt)); |
72 | } | 73 | } |
73 | 74 | ||
74 | void htmlf(const char *format, ...) | 75 | void htmlf(const char *format, ...) |