Skip to contentSkip to conversation

libxl: save/restore errno in SIGCHLD handler

PATCH In review Ian Jackson 2 participants 4 messages Nov 11, 2013 – Nov 25, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 tools/libxl/libxl_fork.c |    2 ++
 1 file changed, 2 insertions(+)
tools/libxl/libxl_fork.c +2 -0
index 044ddad..b6f0b2d 100644
@@ -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)
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Ian Jackson

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.

Quoted 19 lines
---
 tools/libxl/libxl_fork.c |    2 ++
 1 file changed, 2 insertions(+)
tools/libxl/libxl_fork.c +2 -0
index 044ddad..b6f0b2d 100644
@@ -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)
#2 lore raw

Ian Campbell writes ("Re: [PATCH] libxl: save/restore errno in SIGCHLD handler"):

Quoted 10 lines · Ian Jackson
Quoted 7 lines

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.

Thanks, pushed.

Ian.

#3 lore raw

Ian Jackson writes ("Re: [PATCH] libxl: save/restore errno in SIGCHLD handler"):

Quoted 6 lines

Ian Campbell writes ("Re: [PATCH] libxl: save/restore errno in SIGCHLD handler"):

Quoted 5 lines · Ian Jackson
Quoted 4 lines

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.)

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

This fix should be backported in due course.

Thanks, pushed.

Now applied to 4.3. Was not applicable to 4.2, 4.1.

Ian.