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 <Ian.Jackson@eu.citrix.com>
---
tools/libxl/libxl_fork.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c
index 044ddad..b6f0b2d 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)
--
1.7.10.4
Ian Campbell
2013-Nov-11 17:28 UTC
Re: [PATCH] libxl: save/restore errno in SIGCHLD handler
On Mon, 2013-11-11 at 17:20 +0000, Ian Jackson wrote:> 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 <Ian.Jackson@eu.citrix.com>Acked-by: Ian Campbell <ian.campbell@citrix.com>> --- > tools/libxl/libxl_fork.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c > index 044ddad..b6f0b2d 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)
Ian Jackson
2013-Nov-12 15:30 UTC
Re: [PATCH] libxl: save/restore errno in SIGCHLD handler
Ian Campbell writes ("Re: [PATCH] libxl: save/restore errno in SIGCHLD
handler"):> On Mon, 2013-11-11 at 17:20 +0000, Ian Jackson wrote:
> > 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 <Ian.Jackson@eu.citrix.com>
>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Thanks, pushed.
Ian.
Ian Jackson
2013-Nov-25 13:58 UTC
Re: [PATCH] libxl: save/restore errno in SIGCHLD handler
Ian Jackson writes ("Re: [PATCH] libxl: save/restore errno in SIGCHLD
handler"):> Ian Campbell writes ("Re: [PATCH] libxl: save/restore errno in SIGCHLD
handler"):
> > On Mon, 2013-11-11 at 17:20 +0000, Ian Jackson wrote:
> > > 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 <Ian.Jackson@eu.citrix.com>
> >
> > Acked-by: Ian Campbell <ian.campbell@citrix.com>
>
> Thanks, pushed.
Now applied to 4.3. Was not applicable to 4.2, 4.1.
Ian.