summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2019-03-05 20:07:31 -0800
committerDamjan Marion <dmarion@me.com>2019-03-07 10:26:12 +0000
commit8905347d815a9ca0a7453351dbee7c94ebb14e49 (patch)
tree135d5b115cdc9caad277f46744940dd4a800fbc1
parent313f1b9e5b964fc2e6f654576e2dd50a904846d6 (diff)
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 <sluong@cisco.com>
-rw-r--r--src/vlibmemory/memory_shared.c2
1 files changed, 1 insertions, 1 deletions
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);