1
0
Derivar 0

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.
Este cometimento está contido em:
Jason A. Donenfeld 2013-03-20 20:44:20 +01:00
ascendente 40e1d9b617
cometimento 6d7e3596eb
1 ficheiros modificados com 3 adições e 2 eliminações

5
html.c
Ver ficheiro

@ -63,12 +63,13 @@ char *fmt(const char *format, ...)
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, ...)