tools/libxl: Initialise both parts of ctx->sigchld_selfpipe[] to -1
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 18 Aug 2014 13:02:37 +0000 (14:02 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 27 Aug 2014 01:30:25 +0000 (02:30 +0100)
Otherwise, if it is not used, libxl_ctx_free() will close fd 0.

Reported-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl.c

index 352653965413b7147cfac8a0147f0677c21d035f..a1e0b5e3250c838fb3659994dc09902897743ee8 100644 (file)
@@ -71,6 +71,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
     ctx->childproc_user = 0;
         
     ctx->sigchld_selfpipe[0] = -1;
+    ctx->sigchld_selfpipe[1] = -1;
     libxl__ev_fd_init(&ctx->sigchld_selfpipe_efd);
 
     /* The mutex is special because we can't idempotently destroy it */