summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-11 22:17:15 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-11 22:17:15 +0100
commit91bf3b3e124575f6f647bff29766e9d992f55b32 (patch)
tree4955024781a96de12e5bfbbaf53630cc1f4d0d3c
parentb6741478e7661c7e580e5dcfd6a6fccd1899c1d0 (diff)
journal: don't go belly up when an stdout/stderr client terminates the connection
-rw-r--r--src/journal/journald-stream.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index e887f01a49..b2291a260f 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -293,7 +293,8 @@ static int stdout_stream_process(sd_event_source *es, int fd, uint32_t revents,
if ((revents|EPOLLIN|EPOLLHUP) != (EPOLLIN|EPOLLHUP)) {
log_error("Got invalid event from epoll for stdout stream: %"PRIx32, revents);
- return -EIO;
+ r = -EIO;
+ goto terminate;
}
l = read(s->fd, s->buffer+s->length, sizeof(s->buffer)-1-s->length);
@@ -303,25 +304,23 @@ static int stdout_stream_process(sd_event_source *es, int fd, uint32_t revents,
return 0;
log_warning("Failed to read from stream: %m");
- goto fail;
+ r = -errno;
+ goto terminate;
}
if (l == 0) {
r = stdout_stream_scan(s, true);
- if (r < 0)
- goto fail;
-
- return 0;
+ goto terminate;
}
s->length += l;
r = stdout_stream_scan(s, false);
if (r < 0)
- goto fail;
+ goto terminate;
return 1;
-fail:
+terminate:
stdout_stream_free(s);
return 0;
}