From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatoly Burakov Subject: [PATCH 2/2] eal: fix not checking unlock result Date: Tue, 17 Apr 2018 16:42:29 +0100 Message-ID: <19c4033ae0d07a666f8142c8dd06b9ac0eb45af3.1523977960.git.anatoly.burakov@intel.com> References: Cc: thomas@monjalon.net, anatoly.burakov@intel.com To: dev@dpdk.org Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 29337CFC6 for ; Tue, 17 Apr 2018 17:42:33 +0200 (CEST) In-Reply-To: In-Reply-To: References: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Coverity issue: 272607 Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists") Cc: anatoly.burakov@intel.com Signed-off-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c index 009f963..01fee51 100644 --- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c +++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c @@ -304,8 +304,11 @@ clear_hugedir(const char * hugedir) /* if lock succeeds, unlock and remove the file */ if (lck_result != -1) { lck.l_type = F_UNLCK; - fcntl(fd, F_SETLK, &lck); - unlinkat(dir_fd, dirent->d_name, 0); + if (fcntl(fd, F_SETLK, &lck) < 0) + RTE_LOG(ERR, EAL, "Couldn't unlock %s: %s\n", + dirent->d_name, strerror(errno)); + else + unlinkat(dir_fd, dirent->d_name, 0); } close (fd); dirent = readdir(dir); -- 2.7.4