]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/elf_py.c
Merge pull request #13659 from donaldsharp/increase_mgmt_time
[mirror_frr.git] / lib / elf_py.c
index 05f5aef766fb4080fbc52d7e61d37103d49e824b..d473dc10cbf0ece5eeb465f419bec8a768e5d235 100644 (file)
@@ -1140,7 +1140,8 @@ 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);
-               close(fd);
+               if (fd > 0)
+                       close(fd);
                goto out;
        }
        w->len = st.st_size;