]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-remote: make the child pipe non-blocking
authorDan Dedrick <ddedrick@lexmark.com>
Wed, 4 May 2016 21:06:45 +0000 (17:06 -0400)
committerDan Dedrick <ddedrick@lexmark.com>
Mon, 10 Oct 2016 19:11:01 +0000 (15:11 -0400)
We are going to add this child as a source to our event loop so we don't
want to block when reading data from it as this will prevent us from
processing other events. Specifically this will block the signalfds
which means if we are waiting for data from curl we won't handle SIGTERM
or SIGINT until we happen to get more data.

src/journal-remote/journal-remote.c

index a9009cfefeb16502272b6b17718c4d0ed5305619..d86c3681b197447246253b2f1f93910a63c4c1e0 100644 (file)
@@ -127,6 +127,10 @@ static int spawn_child(const char* child, char** argv) {
         if (r < 0)
                 log_warning_errno(errno, "Failed to close write end of pipe: %m");
 
+        r = fd_nonblock(fd[0], true);
+        if (r < 0)
+                log_warning_errno(errno, "Failed to set child pipe to non-blocking: %m");
+
         return fd[0];
 }