]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ptyfwd: don't set prio if event source that might not exist
authorLennart Poettering <lennart@poettering.net>
Fri, 4 Sep 2020 21:52:39 +0000 (23:52 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 4 Sep 2020 21:52:41 +0000 (23:52 +0200)
We support read-only ptyfwd options, and on those the input event source
won't be allocated. Deal with that and don't invoke a function on it
that will then instantly fail.

src/shared/ptyfwd.c

index fe17b3781aafc730a381d3dfbe1389a0bd9addf5..6d67c079e4b6481c35ba44fb7b34d4a300df5d8a 100644 (file)
@@ -572,9 +572,11 @@ int pty_forward_set_priority(PTYForward *f, int64_t priority) {
         int r;
         assert(f);
 
-        r = sd_event_source_set_priority(f->stdin_event_source, priority);
-        if (r < 0)
-                return r;
+        if (f->stdin_event_source) {
+                r = sd_event_source_set_priority(f->stdin_event_source, priority);
+                if (r < 0)
+                        return r;
+        }
 
         r = sd_event_source_set_priority(f->stdout_event_source, priority);
         if (r < 0)