pkgsrc-Changes-HG archive

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

[pkgsrc/pkg_install-renovation]: pkgsrc/pkgtools/pkg_install/files pkg_instal...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d2cbbacd0d8a
branches:  pkg_install-renovation
changeset: 541560:d2cbbacd0d8a
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Fri Jun 27 15:25:52 2008 +0000

description:
pkg_install-20080627:
Restore current directory before processing a package on the command
line to allow installing more than one package with full filename.

diffstat:

 pkgtools/pkg_install/files/add/perform.c |  14 +++++++++++---
 pkgtools/pkg_install/files/lib/version.h |   4 ++--
 2 files changed, 13 insertions(+), 5 deletions(-)

diffs (62 lines):

diff -r 7350f7001ef0 -r d2cbbacd0d8a pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Sun Jun 22 22:10:45 2008 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Fri Jun 27 15:25:52 2008 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.70.4.9 2008/06/04 17:28:48 joerg Exp $   */
+/*     $NetBSD: perform.c,v 1.70.4.10 2008/06/27 15:25:52 joerg Exp $  */
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: perform.c,v 1.70.4.9 2008/06/04 17:28:48 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.70.4.10 2008/06/27 15:25:52 joerg Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -1330,9 +1330,12 @@
 int
 pkg_perform(lpkg_head_t *pkgs)
 {
-       int     errors = 0;
+       int     oldcwd, errors = 0;
        lpkg_t *lpp;
 
+       if ((oldcwd = open(".", O_RDONLY, 0)) == -1)
+               err(EXIT_FAILURE, "unable to open cwd");
+
        while ((lpp = TAILQ_FIRST(pkgs)) != NULL) {
                path_prepend_from_pkgname(lpp->lp_name);
                if (pkg_do(lpp->lp_name, Automatic))
@@ -1340,7 +1343,12 @@
                path_prepend_clear();
                TAILQ_REMOVE(pkgs, lpp, lp_link);
                free_lpkg(lpp);
+
+               if (fchdir(oldcwd) == -1)
+                       err(EXIT_FAILURE, "unable to restore cwd");
        }
 
+       close(oldcwd);
+
        return errors;
 }
diff -r 7350f7001ef0 -r d2cbbacd0d8a pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Sun Jun 22 22:10:45 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Fri Jun 27 15:25:52 2008 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.102.2.6 2008/06/04 17:28:48 joerg Exp $  */
+/*     $NetBSD: version.h,v 1.102.2.7 2008/06/27 15:25:52 joerg Exp $  */
 
 /*
  * Copyright (c) 2001 Thomas Klausner.  All rights reserved.
@@ -27,6 +27,6 @@
 #ifndef _INST_LIB_VERSION_H_
 #define _INST_LIB_VERSION_H_
 
-#define PKGTOOLS_VERSION "20080604"
+#define PKGTOOLS_VERSION "20080627"
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index