From: Ian Jackson Date: Mon, 11 Nov 2013 17:17:55 +0000 (+0000) Subject: libxl: save/restore errno in SIGCHLD handler X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5983 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=704d10289bcaee46a3ef6cdc7966186e3b8033fa;p=xen.git libxl: save/restore errno in SIGCHLD handler Without this, code interrupted by SIGCHLD may experience strange values of errno. (As far as I know this is not the cause of any reported bugs.) This fix should be backported in due course. Signed-off-by: Ian Jackson Acked-by: Ian Campbell --- diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c index 044ddad139..b6f0b2d034 100644 --- a/tools/libxl/libxl_fork.c +++ b/tools/libxl/libxl_fork.c @@ -157,8 +157,10 @@ int libxl__carefd_fd(const libxl__carefd *cf) static void sigchld_handler(int signo) { + int esave = errno; int e = libxl__self_pipe_wakeup(sigchld_owner->sigchld_selfpipe[1]); assert(!e); /* errors are probably EBADF, very bad */ + errno = esave; } static void sigchld_removehandler_core(void)