[PATCH] html.c: die when write fails

John Keeping john at keeping.me.uk
Sat May 18 16:57:03 CEST 2013


If we fail to write HTML output once, there's no point carrying on so
just write a failure message once and die.  By using Git's die_errno
function we also let the user know in what way the write failed.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 html.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/html.c b/html.c
index f7772dc..03277db 100644
--- a/html.c
+++ b/html.c
@@ -78,7 +78,7 @@ char *fmtalloc(const char *format, ...)
 void html_raw(const char *data, size_t size)
 {
 	if (write(htmlfd, data, size) != size)
-		fprintf(stderr, "[html.c] html output truncated.\n");
+		die_errno("write error on html output");
 }
 
 void html(const char *txt)
-- 
1.8.3.rc2.285.gfc18c2c



More information about the CGit mailing list