summaryrefslogtreecommitdiff
path: root/lib/elf_py.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-05-02 09:25:04 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-07-24 13:31:37 -0400
commit0b74cd002c8252746f6f0296d586115cc287ab7e (patch)
treeab65dca04ee29a18ce7350fae8a4f602d5526e70 /lib/elf_py.c
parent9e32b73634a8bbe893f2425ee89ee27651d93408 (diff)
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 <sharpd@nvidia.com>
Diffstat (limited to 'lib/elf_py.c')
-rw-r--r--lib/elf_py.c2
1 files changed, 1 insertions, 1 deletions
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;
}