about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2013-03-20 20:44:20 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2013-03-20 21:08:32 +0100
commit6d7e3596ebb387265d8cfdc5b312e0ea76da8c8a (patch)
treee160033edb9a9077b077c7cf2d6d65f8856d6643
parentui-shared: squelch compiler warning. (diff)
downloadcgit-pink-6d7e3596ebb387265d8cfdc5b312e0ea76da8c8a.tar.gz
cgit-pink-6d7e3596ebb387265d8cfdc5b312e0ea76da8c8a.zip
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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/html.c b/html.c
index b5c6903..d60a41f 100644
--- a/html.c
+++ b/html.c
@@ -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, ...)
une McEnroe 2019-01-13Enable warnings in libeditJune McEnroe 2019-01-13Show full path in RPS1June McEnroe 2019-01-13Shorten $HOME to ~ in prompt expansionJune McEnroe 2019-01-13Document PSlitJune McEnroe 2019-01-13Document PS0June McEnroe 2019-01-13Set PS0 in cashJune McEnroe 2019-01-13Add PS0June McEnroe 2019-01-13Change default ENV from cashrc to env.shJune McEnroe 2019-01-13Use colours in cash promptsJune McEnroe 2019-01-12Set PSlit like NetBSD shJune McEnroe 2019-01-12Install gnupg2 from pkgsrc and symlink gpgJune McEnroe 2019-01-12Reference cash builtin man pages in cash.1 SEE ALSOJune McEnroe 2019-01-12Restore cash builtin man page datesJune McEnroe 2019-01-12Use local libeditJune McEnroe 2019-01-12Replace libedit MakefileJune McEnroe 2019-01-11Import /usr/src/lib/libedit from NetBSD 8.0June McEnroe 2019-01-11Add PSlit for prompt escapesJune McEnroe 2019-01-11Don't make depend automaticallyJune McEnroe