From 0b74cd002c8252746f6f0296d586115cc287ab7e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 2 May 2023 09:25:04 -0400 Subject: [PATCH] lib: Fix elf_py.c for coverity David rightly pointed out that having a test for fd > 0 would technically not be right, but not wrong for this portion of the code since we know that we would never get a fd = 0 in this section. In any event let's make coverity happy and move on with our life. Signed-off-by: Donald Sharp --- lib/elf_py.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elf_py.c b/lib/elf_py.c index d473dc10cb..81ca668e70 100644 --- a/lib/elf_py.c +++ b/lib/elf_py.c @@ -1140,7 +1140,7 @@ static PyObject *elffile_load(PyTypeObject *type, PyObject *args, fd = open(filename, O_RDONLY | O_NOCTTY); if (fd < 0 || fstat(fd, &st)) { PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename); - if (fd > 0) + if (fd >= 0) close(fd); goto out; } -- 2.39.5