From 5d20e3dc27b27af3f5d582c87ba82c30a9163e98 Mon Sep 17 00:00:00 2001 From: sin Date: Wed, 13 Aug 2014 23:20:20 +0100 Subject: [PATCH] No need for MAXBUFLEN+1 Return -1 if writedata() fails. --- quark.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quark.c b/quark.c index f5a74a3..9a2fd1f 100644 --- a/quark.c +++ b/quark.c @@ -91,8 +91,8 @@ static char location[256]; static int running = 1; static int status; static char host[NI_MAXHOST]; -static char reqbuf[MAXBUFLEN+1]; -static char resbuf[MAXBUFLEN+1]; +static char reqbuf[MAXBUFLEN]; +static char resbuf[MAXBUFLEN]; static char reqhost[256]; static char reqmod[256]; static int fd = -1; @@ -115,7 +115,7 @@ writedata(const char *buf, size_t buf_len) { for (offset = 0; offset < buf_len; offset += r) { if ((r = write(req.fd, buf + offset, buf_len - offset)) == -1) { logerrmsg("client %s closed connection\n", host); - return 1; + return -1; } } return 0;