summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-07-14 14:30:55 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-07-14 14:30:55 +0000
commit08662f8255b6f168b75abc997769b41b69559082 (patch)
tree434739cb5b3594caf225624c38d2ef3130f1789b
parentd0c7a4001e4c2db27dfd77ccea6890422b6114e8 (diff)
downloads6-rc-08662f8255b6f168b75abc997769b41b69559082.tar.xz
Don't remove the directory if it preexisted
-rw-r--r--src/s6-rc/s6-rc-init.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/s6-rc/s6-rc-init.c b/src/s6-rc/s6-rc-init.c
index d4b0218..b22d399 100644
--- a/src/s6-rc/s6-rc-init.c
+++ b/src/s6-rc/s6-rc-init.c
@@ -19,10 +19,13 @@
#define USAGE "s6-rc-init [ -c compiled ] [ -l live ] [ -t timeout ] scandir"
#define dieusage() strerr_dieusage(100, USAGE)
+static int keepdir = 0 ;
+
static void cleanup (char const *live)
{
int e = errno ;
- rm_rf(live) ;
+ if (keepdir) rmstar(live) ;
+ else rm_rf(live) ;
errno = e ;
}
@@ -86,6 +89,7 @@ int main (int argc, char const *const *argv)
{
if (errno != EEXIST) strerr_diefu2sys(111, "mkdir ", live) ;
check_emptydir(live) ;
+ keepdir = 1 ;
}
{