chiark / gitweb /
journal-remote: do not attempt to read from µhttpd connections
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 18 Mar 2014 02:11:18 +0000 (22:11 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 18 Mar 2014 04:02:09 +0000 (00:02 -0400)
This chunk got lost in one of the rebases :(

src/journal/journal-remote-parse.c

index c961844c443e7f08d86a0052602e78b73b907821..142de0ed1f004a56a25e83378c43f9ec58fc0413 100644 (file)
@@ -54,6 +54,10 @@ static int get_line(RemoteSource *source, char **line, size_t *size) {
                 goto docopy;
 
  resize:
                 goto docopy;
 
  resize:
+        if (source->fd < 0)
+                /* we have to wait for some data to come to us */
+                return -EWOULDBLOCK;
+
         if (source->size - source->filled < LINE_CHUNK) {
                 // XXX: add check for maximum line length
 
         if (source->size - source->filled < LINE_CHUNK) {
                 // XXX: add check for maximum line length
 
@@ -130,6 +134,10 @@ static int fill_fixed_size(RemoteSource *source, void **data, size_t size) {
         assert(data);
 
         while(source->filled < size) {
         assert(data);
 
         while(source->filled < size) {
+                if (source->fd < 0)
+                        /* we have to wait for some data to come to us */
+                        return -EWOULDBLOCK;
+
                 if (!GREEDY_REALLOC(source->buf, source->size, size))
                         return log_oom();
 
                 if (!GREEDY_REALLOC(source->buf, source->size, size))
                         return log_oom();