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.
This commit is contained in:
Lennart Poettering 2020-09-04 23:52:39 +02:00
parent fb2cfa6c13
commit 1ba37106b3
1 changed files with 5 additions and 3 deletions

View 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)