summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1998-07-17 14:56:31 +0000
committereivind <eivind@FreeBSD.org>1998-07-17 14:56:31 +0000
commit3aff34f53dcea1bbe2779a59d3501d0471c2190b (patch)
tree7d0eb3c235b8bdc25e0e7cba48eeeb8e0b4340b4 /usr.sbin/pkg_install
parent701b4455095ca58f21e77f2aaba7f27a166a9aa7 (diff)
downloadFreeBSD-src-3aff34f53dcea1bbe2779a59d3501d0471c2190b.zip
FreeBSD-src-3aff34f53dcea1bbe2779a59d3501d0471c2190b.tar.gz
Avoid race-conditions on playpen delete.
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/add/perform.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c
index 983c835..dc7c430 100644
--- a/usr.sbin/pkg_install/add/perform.c
+++ b/usr.sbin/pkg_install/add/perform.c
@@ -1,6 +1,6 @@
#ifndef lint
static const char rcsid[] =
- "$Id: perform.c,v 1.48 1998/01/21 06:08:35 jkh Exp $";
+ "$Id: perform.c,v 1.49 1998/02/16 17:16:14 jkh Exp $";
#endif
/*
@@ -33,6 +33,7 @@ static const char rcsid[] =
static int pkg_do(char *);
static int sanity_check(char *);
static char LogDir[FILENAME_MAX];
+static int zapLogDir; /* Should we delete LogDir? */
int
pkg_perform(char **pkgs)
@@ -73,6 +74,7 @@ pkg_do(char *pkg)
int inPlace;
code = 0;
+ zapLogDir = 0;
LogDir[0] = '\0';
strcpy(playpen, FirstPen);
inPlace = 0;
@@ -364,6 +366,7 @@ pkg_do(char *pkg)
goto success; /* well, partial anyway */
}
sprintf(LogDir, "%s/%s", (tmp = getenv(PKG_DBDIR)) ? tmp : DEF_LOG_DIR, PkgName);
+ zapLogDir = 1;
if (Verbose)
printf("Attempting to record package into %s..\n", LogDir);
if (make_hierarchy(LogDir)) {
@@ -476,7 +479,7 @@ cleanup(int signo)
in_cleanup = 1;
if (signo)
printf("Signal %d received, cleaning up..\n", signo);
- if (!Fake && LogDir[0])
+ if (!Fake && zapLogDir && LogDir[0])
vsystem("%s -rf %s", REMOVE_CMD, LogDir);
leave_playpen();
}
OpenPOWER on IntegriCloud