From: Wei Liu Subject: [PATCH for-4.6 10/13] xl: valid fd can be 0 in main_loadpolicy Date: Thu, 23 Jul 2015 08:59:11 +0100 Message-ID: <1437638354-14216-11-git-send-email-wei.liu2@citrix.com> References: <1437638354-14216-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZIBf1-0007V2-73 for xen-devel@lists.xenproject.org; Thu, 23 Jul 2015 08:15:23 +0000 In-Reply-To: <1437638354-14216-1-git-send-email-wei.liu2@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: Xen-devel Cc: Wei Liu , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Also fixed some style problems while I was there. Signed-off-by: Wei Liu --- tools/libxl/xl_cmdimpl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 7e279cd..3717568 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -7856,7 +7856,7 @@ int main_loadpolicy(int argc, char **argv) polFName = argv[optind]; polFd = open(polFName, O_RDONLY); - if ( polFd < 0 ) { + if (polFd < 0) { fprintf(stderr, "Error occurred opening policy file '%s': %s\n", polFName, strerror(errno)); ret = -1; @@ -7864,7 +7864,7 @@ int main_loadpolicy(int argc, char **argv) } ret = stat(polFName, &info); - if ( ret < 0 ) { + if (ret < 0) { fprintf(stderr, "Error occurred retrieving information about" "policy file '%s': %s\n", polFName, strerror(errno)); goto done; @@ -7896,7 +7896,7 @@ int main_loadpolicy(int argc, char **argv) done: free(polMemCp); - if ( polFd > 0 ) + if (polFd >= 0) close(polFd); return ret; -- 1.9.1