From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatoly Burakov Subject: [PATCH 2/4] fbarray: add check for failed file descriptor open Date: Tue, 17 Apr 2018 16:44:06 +0100 Message-ID: References: Cc: thomas@monjalon.net, anatoly.burakov@intel.com To: dev@dpdk.org Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D07998E82 for ; Tue, 17 Apr 2018 17:44:11 +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: 272564 Fixes: c44d09811b40 ("eal: add shared indexed file-backed array") Cc: anatoly.burakov@intel.com Signed-off-by: Anatoly Burakov --- lib/librte_eal/common/eal_common_fbarray.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c index 8aa9013..95a7c8e 100644 --- a/lib/librte_eal/common/eal_common_fbarray.c +++ b/lib/librte_eal/common/eal_common_fbarray.c @@ -583,6 +583,11 @@ rte_fbarray_destroy(struct rte_fbarray *arr) eal_get_fbarray_path(path, sizeof(path), arr->name); fd = open(path, O_RDONLY); + if (fd < 0) { + RTE_LOG(ERR, EAL, "Could not open fbarray file: %s\n", + strerror(errno)); + return -1; + } if (flock(fd, LOCK_EX | LOCK_NB)) { RTE_LOG(DEBUG, EAL, "Cannot destroy fbarray - another process is using it\n"); rte_errno = EBUSY; -- 2.7.4