Apparently nobody had tested it before on a system that had sendfile.
Why would you have sendfile and not writev? Perhaps you're trying to
test the no-iovecs code to make sure it still works.
if (howmuch < 0 || howmuch > buffer->total_len)
howmuch = buffer->total_len;
- {
+ if (howmuch > 0) {
#ifdef USE_SENDFILE
struct evbuffer_chain *chain = buffer->first;
if (chain != NULL && (chain->flags & EVBUFFER_SENDFILE))
n = evbuffer_write_sendfile(buffer, fd, howmuch);
- else
+ else {
#endif
#ifdef USE_IOVEC_IMPL
n = evbuffer_write_iovec(buffer, fd, howmuch);
#else
void *p = evbuffer_pullup(buffer, howmuch);
n = write(fd, p, howmuch);
+#endif
+#ifdef USE_SENDFILE
+ }
#endif
}