Welcome to little lamb

Code » anopa » commit 73dc448

enable: Fix deleting "log" with --upgrade

author Olivier Brunel
2015-10-16 13:38:25 UTC
committer Olivier Brunel
2015-10-16 18:17:11 UTC
parent b02c4477b8f37b949d65d425abbb0cb239e67c76

enable: Fix deleting "log" with --upgrade

When clearing the servicedir during an upgrade, the folder "log" (i.e.
the logger) was removed; It is now properly treated.

src/libanopa/enable_service.c +4 -2

diff --git a/src/libanopa/enable_service.c b/src/libanopa/enable_service.c
index 35889d7..ff4e5c0 100644
--- a/src/libanopa/enable_service.c
+++ b/src/libanopa/enable_service.c
@@ -154,8 +154,10 @@ clear_dir (const char *path, int excludes, aa_warn_fn warn_fn)
 
         if (d->d_type == DT_DIR)
         {
-            r = clear_dir (satmp.s + salen, 0, warn_fn);
-            if (r == 0)
+            int is_log = (str_equal (d->d_name, "log")) ? 1 : 0;
+
+            r = clear_dir (satmp.s + salen, is_log, warn_fn);
+            if (r == 0 && !is_log)
                 r = rmdir (satmp.s + salen);
         }
         else