Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/pkg_install Prevent some minor descriptor leaks.



details:   https://anonhg.NetBSD.org/src/rev/43827a6bfb95
branches:  trunk
changeset: 504543:43827a6bfb95
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Sun Mar 04 18:16:42 2001 +0000

description:
Prevent some minor descriptor leaks.

diffstat:

 usr.sbin/pkg_install/create/perform.c |  7 +++++--
 usr.sbin/pkg_install/delete/perform.c |  6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diffs (59 lines):

diff -r 3cd5dab566d4 -r 43827a6bfb95 usr.sbin/pkg_install/create/perform.c
--- a/usr.sbin/pkg_install/create/perform.c     Sun Mar 04 17:50:51 2001 +0000
+++ b/usr.sbin/pkg_install/create/perform.c     Sun Mar 04 18:16:42 2001 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.24 2000/12/13 03:17:54 hubertf Exp $     */
+/*     $NetBSD: perform.c,v 1.25 2001/03/04 18:16:42 hubertf Exp $     */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.38 1997/10/13 15:03:51 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.24 2000/12/13 03:17:54 hubertf Exp $");
+__RCSID("$NetBSD: perform.c,v 1.25 2001/03/04 18:16:42 hubertf Exp $");
 #endif
 #endif
 
@@ -275,6 +275,9 @@
        /* Slurp in the packing list */
        read_plist(&plist, pkg_in);
 
+       if (pkg_in != stdin)
+               fclose(pkg_in);
+
        /* Prefix should override the packing list */
        if (Prefix) {
                delete_plist(&plist, FALSE, PLIST_CWD, NULL);
diff -r 3cd5dab566d4 -r 43827a6bfb95 usr.sbin/pkg_install/delete/perform.c
--- a/usr.sbin/pkg_install/delete/perform.c     Sun Mar 04 17:50:51 2001 +0000
+++ b/usr.sbin/pkg_install/delete/perform.c     Sun Mar 04 18:16:42 2001 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.31 2000/05/07 00:33:28 hubertf Exp $     */
+/*     $NetBSD: perform.c,v 1.32 2001/03/04 18:16:43 hubertf Exp $     */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.31 2000/05/07 00:33:28 hubertf Exp $");
+__RCSID("$NetBSD: perform.c,v 1.32 2001/03/04 18:16:43 hubertf Exp $");
 #endif
 #endif
 
@@ -270,6 +270,7 @@
                warnx("unable to change to previous directory, deinstall failed");
                fail = 1;
        }
+       close(oldcwd);
 
        return (fail);
 }
@@ -688,5 +689,6 @@
                if (fchdir(oldcwd) == FAIL)
                        err(1, "unable to change to previous directory");
        }
+       close(oldcwd);
        return err_cnt;
 }



Home | Main Index | Thread Index | Old Index