From 08662f8255b6f168b75abc997769b41b69559082 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 14 Jul 2015 14:30:55 +0000 Subject: Don't remove the directory if it preexisted --- src/s6-rc/s6-rc-init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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 ; } { -- cgit v1.2.3