From e093317ded6ea3543ebd2f8aabd2d2b2b7fc21f0 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 17 Feb 2022 11:34:31 +0000 Subject: Full errno paranoia in selfpipe signal handler Signed-off-by: Laurent Bercot --- src/libstddjb/selfpipe_internal.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/libstddjb/selfpipe_internal.c b/src/libstddjb/selfpipe_internal.c index 34bdd51..45063bc 100644 --- a/src/libstddjb/selfpipe_internal.c +++ b/src/libstddjb/selfpipe_internal.c @@ -16,6 +16,7 @@ int selfpipe_fd = -1 ; #else #include +#include #include @@ -23,8 +24,10 @@ int selfpipe[2] = { -1, -1 } ; void selfpipe_tophalf (int s) { + int e = errno ; unsigned char c = (unsigned char)s ; write(selfpipe[1], (char *)&c, 1) ; + errno = e ; } #endif -- cgit v1.2.3