From: Ian Jackson Subject: Re: [PATCH] xl: close nullfd after dup2'ing it to stdin Date: Tue, 16 Feb 2016 17:45:24 +0000 Message-ID: <22211.24628.386971.873827@mariner.uk.xensource.com> References: <1455622545-22269-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1455622545-22269-1-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: andrew.cooper3@citrix.com, wei.liu2@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("[PATCH] xl: close nullfd after dup2'ing it to stdin"): > Taking care not to do so if nullfd happens (somehow) to have the same > fd number as stdin/out/err. I think that can only happen if the program (the process) has a serious problem: ie, fd 0 1 or 2 would have to be closed. If that happens many other things can go badly wrong. If this is causing Coverity to complain I would suggest adding assert(nullfd >= 3); assert(logfile >= 3); instead. Ian.