]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
script: restore errno in signal handler
authorKarel Zak <kzak@redhat.com>
Thu, 14 Nov 2013 13:38:06 +0000 (14:38 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 14 Nov 2013 13:42:23 +0000 (14:42 +0100)
References: https://plus.google.com/+LennartPoetteringTheOneAndOnly/posts/gHSscCJkakd
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/script.c

index a0cad8cbc20f94321884a092d15e1a29ff405e6b..1de0c3a81662b82f4836e58eb60e7a674409fd5f 100644 (file)
@@ -327,12 +327,15 @@ void
 finish(int dummy __attribute__ ((__unused__))) {
        int status;
        pid_t pid;
+       int errsv = errno;
 
        while ((pid = wait3(&status, WNOHANG, 0)) > 0)
                if (pid == child) {
                        childstatus = status;
                        die = 1;
                }
+
+       errno = errsv;
 }
 
 void