[hackers] [quark] Don't let r be uninitialized || FRIGN
commit a0a2b864a69acca492e8e78ff2c246d37ed42346
Author: FRIGN <dev_AT_frign.de>
Date: Wed Aug 13 21:05:53 2014 +0200
Don't let r be uninitialized
Restore the functionality before the do-while-loop was removed.
diff --git a/quark.c b/quark.c
index 259b5cf..831564b 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -397,14 +397,16 @@ request(void) {
size_t offset = 0;
/* read request into reqbuf (MAXBUFLEN byte of reqbuf is emergency 0 terminator */
- for (; r > 0 && offset < MAXBUFLEN && (!strstr(reqbuf, "
") || !strstr(reqbuf, "
"));) {
- if ((r = read(req.fd, reqbuf + offset, MAXBUFLEN - offset)) == -1) {
- logerrmsg("error read: %s
", strerror(errno));
- return -1;
- }
+ for (; (r = read(req.fd, reqbuf + offset, MAXBUFLEN - offset)) > 0 && offset < MAXBUFLEN
+ && (!strstr(reqbuf, "
") || !strstr(reqbuf, "
")); )
+ {
offset += r;
reqbuf[offset] = 0;
}
+ if (r == -1) {
+ logerrmsg("error read: %s
", strerror(errno));
+ return -1;
+ }
/* extract host and mod */
if (getreqentry("Host:", reqhost, LENGTH(reqhost), "
") != 0)
Received on Wed Aug 13 2014 - 21:04:35 CEST
This archive was generated by hypermail 2.3.0
: Wed Aug 13 2014 - 21:12:08 CEST