From: Lennart Poettering Date: Fri, 4 Sep 2020 21:52:39 +0000 (+0200) Subject: ptyfwd: don't set prio if event source that might not exist X-Git-Tag: v247-rc1~294^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ba37106b36b7804054d88fa51ee28641f64037f;p=thirdparty%2Fsystemd.git ptyfwd: don't set prio if event source that might not exist 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. --- diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index fe17b3781aa..6d67c079e4b 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -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)