summaryrefslogtreecommitdiff
path: root/src/libstddjb
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2022-02-17 11:34:31 +0000
committerLaurent Bercot <ska@appnovation.com>2022-02-17 11:34:31 +0000
commite093317ded6ea3543ebd2f8aabd2d2b2b7fc21f0 (patch)
tree193ecd7d4b14133e608f42ad45ebf4fca2d4158c /src/libstddjb
parentd9f541c2b3af552232eb55c114aaefda31b80f8d (diff)
downloadskalibs-e093317ded6ea3543ebd2f8aabd2d2b2b7fc21f0.tar.xz
Full errno paranoia in selfpipe signal handler
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb')
-rw-r--r--src/libstddjb/selfpipe_internal.c3
1 files changed, 3 insertions, 0 deletions
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 <unistd.h>
+#include <errno.h>
#include <skalibs/allreadwrite.h>
@@ -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