commit:     169ad2331b0a84f8a960402b04077ece57bb35e2
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 25 12:19:25 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Jan 25 12:19:25 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=169ad233

qpkg: fix Coverity 207883 Error handling issues

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 qpkg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qpkg.c b/qpkg.c
index 79245d0..14e51ce 100644
--- a/qpkg.c
+++ b/qpkg.c
@@ -389,7 +389,8 @@ int qpkg_main(int argc, char **argv)
                        if (fchmod(fd, 0750) < 0)
                                errp("could not chmod(0750) temp bindir '%s'", 
qpkg_bindir);
        }
-       close(fd);
+       if (fd >= 0)
+               close(fd);
 
        /* we have to change to the root so that we can feed the full paths
         * to tar when we create the binary package. */

Reply via email to