From: Yu Watanabe Date: Mon, 28 Jul 2025 19:51:33 +0000 (+0900) Subject: ptyfwd: split-out shovel_force() X-Git-Tag: v258-rc2~38^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b823809bca6cd531a54fcf0f02427aea7cd3e651;p=thirdparty%2Fsystemd.git ptyfwd: split-out shovel_force() No functional change. Preparation for later change. --- diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index eab81fca806..77bd624ec97 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -815,6 +815,19 @@ static int shovel(PTYForward *f) { return 0; } +static int shovel_force(PTYForward *f) { + assert(f); + + if (!f->master_hangup) + f->master_writable = f->master_readable = true; + if (!f->stdin_hangup) + f->stdin_readable = true; + if (!f->stdout_hangup) + f->stdout_writable = true; + + return shovel(f); +} + static int on_master_event(sd_event_source *e, int fd, uint32_t revents, void *userdata) { PTYForward *f = ASSERT_PTR(userdata); @@ -883,15 +896,7 @@ static int on_exit_event(sd_event_source *e, void *userdata) { if (!pty_forward_drain(f)) { /* If not drained, try to drain the buffer. */ - - if (!f->master_hangup) - f->master_writable = f->master_readable = true; - if (!f->stdin_hangup) - f->stdin_readable = true; - if (!f->stdout_hangup) - f->stdout_writable = true; - - r = shovel(f); + r = shovel_force(f); if (r < 0) return r; }