From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [PATCH] loadpolicy: only close polFd if it is valid Date: Thu, 11 Feb 2016 11:20:10 +0000 Message-ID: <20160211112010.GF17384@citrix.com> References: <1455121959-31657-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: Content-Disposition: inline In-Reply-To: <1455121959-31657-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: wei.liu2@citrix.com, Daniel De Graaf , ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Feb 10, 2016 at 04:32:39PM +0000, Ian Campbell wrote: > It can be -1 at this point. > > CID 1055562 > Signed-off-by: Ian Campbell Acked-by: Wei Liu > --- > tools/flask/utils/loadpolicy.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/flask/utils/loadpolicy.c b/tools/flask/utils/loadpolicy.c > index 47b5139..76710a2 100644 > --- a/tools/flask/utils/loadpolicy.c > +++ b/tools/flask/utils/loadpolicy.c > @@ -115,7 +115,7 @@ done: > if ( ret < 0 ) > fprintf(stderr, "Unable to unmap policy memory: %s\n", strerror(errno)); > } > - if ( polFd ) > + if ( polFd >= 0 ) > close(polFd); > if ( xch ) > xc_interface_close(xch); > -- > 2.1.4 >