From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2018 08:42:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,464,1517904000"; d="scan'208";a="46881057" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga004.fm.intel.com with ESMTP; 17 Apr 2018 08:42:31 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w3HFgUIs029680; Tue, 17 Apr 2018 16:42:30 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w3HFgUwu020535; Tue, 17 Apr 2018 16:42:30 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w3HFgUrC020531; Tue, 17 Apr 2018 16:42:30 +0100 From: Anatoly Burakov To: dev@dpdk.org Cc: thomas@monjalon.net, anatoly.burakov@intel.com Date: Tue, 17 Apr 2018 16:42:29 +0100 Message-Id: <19c4033ae0d07a666f8142c8dd06b9ac0eb45af3.1523977960.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 2/2] eal: fix not checking unlock result X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Apr 2018 15:42:33 -0000 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