aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authorEivind Eklund <eivind@FreeBSD.org>1998-07-17 14:56:31 +0000
committerEivind Eklund <eivind@FreeBSD.org>1998-07-17 14:56:31 +0000
commit4dc6689c096c864e251c54ef01df021f8794aa39 (patch)
treee144f3d8b70a111ba0524eb1bf96b4983960ace2 /usr.sbin/pkg_install
parentccbe4f96fec4afd3a10275c1eb2118275befd0ae (diff)
downloadsrc-4dc6689c096c864e251c54ef01df021f8794aa39.tar.gz
src-4dc6689c096c864e251c54ef01df021f8794aa39.zip
Avoid race-conditions on playpen delete.
Notes
Notes: svn path=/head/; revision=37728
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 983c835ae768..dc7c430982c6 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();
}