From 8905347d815a9ca0a7453351dbee7c94ebb14e49 Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Tue, 5 Mar 2019 20:07:31 -0800 Subject: vlibmemory: coverity woes Coverity complains about resource leak after open when fd gets 0 with below warning. off_by_one: Testing whether handle tfd is strictly greater than zero is suspicious. tfd leaks when it is zero. It is right. 0 is a valid fd. -1 is not. Change-Id: I22c2eb75b99bb6209921b9f874190cbbdf10e6ce Signed-off-by: Steven Luong --- src/vlibmemory/memory_shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vlibmemory') diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c index 7526d87eb4b..703db9da4ec 100644 --- a/src/vlibmemory/memory_shared.c +++ b/src/vlibmemory/memory_shared.c @@ -552,7 +552,7 @@ vl_map_shmem (const char *region_name, int is_vlib) while (nanosleep (&ts, &tsrem) < 0) ts = tsrem; tfd = open ((char *) api_name, O_RDWR); - if (tfd > 0) + if (tfd >= 0) break; } vec_free (api_name); -- cgit 1.2.3-korg