all repos — cgit @ 6d7e3596ebb387265d8cfdc5b312e0ea76da8c8a

a hyperfast web frontend for git written in c

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.
Jason A. Donenfeld Jason@zx2c4.com
Wed, 20 Mar 2013 20:44:20 +0100
commit

6d7e3596ebb387265d8cfdc5b312e0ea76da8c8a

parent

40e1d9b6177558bf4069c09ca6d8e3a682baa988

1 files changed, 3 insertions(+), 2 deletions(-)

jump to
M html.chtml.c

@@ -63,12 +63,13 @@ }

void html_raw(const char *data, size_t size) { - write(htmlfd, data, size); + if (write(htmlfd, data, size) != size) + fprintf(stderr, "[html.c] html output truncated.\n"); } void html(const char *txt) { - write(htmlfd, txt, strlen(txt)); + html_raw(txt, strlen(txt)); } void htmlf(const char *format, ...)