summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig>2007-09-08 09:45:22 +0000
committerrillig <rillig>2007-09-08 09:45:22 +0000
commite3dc025536a363ee9566caf49398219036faa4dd (patch)
treeed0c38f96d5c8c673b2582224a11877cb52364c5 /pkgtools
parent23b4a64d00201667a4736f3ae055cfcff4255689 (diff)
downloadpkgsrc-e3dc025536a363ee9566caf49398219036faa4dd.tar.gz
Avoid EPERM errors from tar when installing packages as an unprivileged
user.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkg_install/files/lib/pen.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/pkgtools/pkg_install/files/lib/pen.c b/pkgtools/pkg_install/files/lib/pen.c
index 52beaa9114e..d952e0a98b9 100644
--- a/pkgtools/pkg_install/files/lib/pen.c
+++ b/pkgtools/pkg_install/files/lib/pen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pen.c,v 1.20 2007/07/16 09:54:55 joerg Exp $ */
+/* $NetBSD: pen.c,v 1.21 2007/09/08 09:45:22 rillig Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: pen.c,v 1.25 1997/10/08 07:48:12 charnier Exp";
#else
-__RCSID("$NetBSD: pen.c,v 1.20 2007/07/16 09:54:55 joerg Exp $");
+__RCSID("$NetBSD: pen.c,v 1.21 2007/09/08 09:45:22 rillig Exp $");
#endif
#endif
@@ -158,6 +158,16 @@ make_playpen(char *pen, size_t pensize, size_t sz)
cleanup(0);
errx(2, "can't mkdtemp '%s'", pen);
}
+
+ /*
+ * On at least NetBSD, the temporary directory may have a group
+ * that isn't in the group list of the current user. In that
+ * case, it is impossible to extract setgid binaries from the
+ * package, since chmod(2) doesn't allow to set the S_ISGID bit
+ * for a group that isn't yours.
+ */
+ (void)chown(pen, -1, getegid());
+
if (Verbose) {
if (sz)
fprintf(stderr,