xl: close nullfd after dup2'ing it to stdin
authorIan Campbell <ian.campbell@citrix.com>
Wed, 17 Feb 2016 10:39:40 +0000 (10:39 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 1 Mar 2016 13:38:50 +0000 (13:38 +0000)
commitbb1372884283100ad65efde1b6b66cc7669505e9
tree5ebcdaea64ae6f5ab9f6db7bfb2b68dab19949af
parent986d9fc3bbf8a6d9d088ca22d1422bd5de249396
xl: close nullfd after dup2'ing it to stdin

We assert that nullfd if not std{in,out,err} since that would result
in closing one of the just dup2'd fds. For this to happen
std{in,out,err} would have needed to be closed, at which point all
sorts of other things could go wrong.

CID: 1130519

It was previously hypothesised[0] that fixing 1130516 would solve this
too, but that appears to not have been the case.

Compile tested only.

[0] http://lists.xenproject.org/archives/html/xen-devel/2013-11/msg02931.html

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: andrew.cooper3@citrix.com
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/xl_cmdimpl.c