tools/libxl: Initialise the fd of the unused half of a datacopier
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 17 Jul 2015 16:59:09 +0000 (17:59 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 17 Jul 2015 17:10:00 +0000 (18:10 +0100)
This bug causes a spurious failure if stdin happens to be an
appropriately readable/writeable pipe which receives a POLLHUP

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_stream_read.c
tools/libxl/libxl_stream_write.c

index 2d17403e44dc1f35448dedcb0ec90e5170877f13..0535e7f21f5c4404dd8161d28f5a3fe31c36eaac 100644 (file)
@@ -609,6 +609,7 @@ static void write_emulator_blob(libxl__egc *egc,
     dc->ao = stream->ao;
     dc->writewhat = "qemu save file";
     dc->writefd = writefd;
+    dc->readfd = -1;
     dc->maxsz = -1;
     dc->callback = write_emulator_done;
 
index 944a87b9900cff2abc8344cc0d172f4cbb5b2b15..96b9b07f277058309d5c2e6529765d1b033fe4b2 100644 (file)
@@ -387,6 +387,7 @@ static void write_emulator_record(libxl__egc *egc,
     dc->ao            = stream->ao;
     dc->readwhat      = "qemu save file";
     dc->readfd        = readfd;
+    dc->writefd       = -1;
     dc->maxsz         = -1;
     dc->readbuf       = stream->emu_body + sizeof(*ehdr);
     dc->bytes_to_read = rec->length - sizeof(*ehdr);