]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
script: fix use of utempter
authorKarel Zak <kzak@redhat.com>
Wed, 16 Nov 2022 08:19:18 +0000 (09:19 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Nov 2022 08:19:18 +0000 (09:19 +0100)
libutempter uses SIGCHLD, but script(1) pty implementation completely
control all signals by signalfd and utempter does not work.

The solution is to setup signalfd later (after libutempter use).

Fixes: https://github.com/util-linux/util-linux/issues/1904
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/script.c

index c918ecd6e9b930c22003a6a4ac0fb0671dc4843f..516a6cf93e4ae9c368a4f5571076a7e52f90d447 100644 (file)
@@ -947,13 +947,16 @@ int main(int argc, char **argv)
                printf(_(".\n"));
        }
 
-#ifdef HAVE_LIBUTEMPTER
-       utempter_add_record(ul_pty_get_childfd(ctl.pty), NULL);
-#endif
 
        if (ul_pty_setup(ctl.pty))
                err(EXIT_FAILURE, _("failed to create pseudo-terminal"));
 
+#ifdef HAVE_LIBUTEMPTER
+       utempter_add_record(ul_pty_get_childfd(ctl.pty), NULL);
+#endif
+
+       if (ul_pty_signals_setup(ctl.pty))
+               err(EXIT_FAILURE, _("failed to initialize signals handler"));
        fflush(stdout);
 
        /*