summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-04-12 00:11:00 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-12 00:11:00 -0400
commita490f2ebd9dbb4b0fb395a2b93f727c56afda218 (patch)
treeb6115ed6b850ffb7da167c95f20ebabd089d5ce4
parent24de3887e5e3bba2b8a4f60d1224ac927b98b1ed (diff)
fix weird slow start issue
-rw-r--r--src/multipart-replace.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/multipart-replace.c b/src/multipart-replace.c
index fa893f2..facca62 100644
--- a/src/multipart-replace.c
+++ b/src/multipart-replace.c
@@ -40,7 +40,7 @@
if (err != 0) { \
error(0, err, "%s", name); \
} else { \
- error(0, errno, "%s: umm... what? Not EOF, but also not error. Here's errno", name); \
+ error(0, 0, "%s: panic: neither feof nor ferror", name); \
} \
ret = EXIT_FAILURE; \
} \
@@ -155,15 +155,17 @@ int multipart_replace_writer(struct multipart_replace_stream *s, int fd, const c
pthread_rwlock_unlock(&s->frontlock);
- /* send the frame to the client */
- if (fwrite(boundary, boundary_len, 1, stream) < 1)
- stdioerror(stream, "dst <- boundary");
- if (fwrite(myframe.buf, myframe.len, 1, stream) < 1)
- stdioerror(stream, "dst <- frame");
- /* send a blank line for pleasantness */
- if (fwrite("\r\n", 2, 1, stream) < 1)
- stdioerror(stream, "dst <- nl");
- fflush(stream);
+ if (myframe.len != 0) {
+ /* send the frame to the client */
+ if (fwrite(boundary, boundary_len, 1, stream) < 1)
+ stdioerror(stream, "dst <- boundary");
+ if (fwrite(myframe.buf, myframe.len, 1, stream) < 1)
+ stdioerror(stream, "dst <- frame");
+ /* send a blank line for pleasantness */
+ if (fwrite("\r\n", 2, 1, stream) < 1)
+ stdioerror(stream, "dst <- nl");
+ fflush(stream);
+ }
/* poll until there's a new frame */
pthread_rwlock_rdlock(&s->frontlock);