summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg>2008-06-27 15:25:52 +0000
committerjoerg <joerg>2008-06-27 15:25:52 +0000
commit2c04277b832288d049d3f101dacbf262ff2726c3 (patch)
treee72f610408a621ee4001014f51a267bc395934f0
parent5cdbe492fb91ef17b1f9cfcc398014a89259c57b (diff)
downloadpkgsrc-2c04277b832288d049d3f101dacbf262ff2726c3.tar.gz
pkg_install-20080627:
Restore current directory before processing a package on the command line to allow installing more than one package with full filename.
-rw-r--r--pkgtools/pkg_install/files/add/perform.c14
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
2 files changed, 13 insertions, 5 deletions
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c
index cf89f4a0e25..a80eec06ab1 100644
--- a/pkgtools/pkg_install/files/add/perform.c
+++ b/pkgtools/pkg_install/files/add/perform.c
@@ -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>
@@ -1330,9 +1330,12 @@ clean_find_archive:
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 @@ pkg_perform(lpkg_head_t *pkgs)
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 --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index c74cae4c9cc..f0014447b66 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -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_ */