]> arthur.barton.de Git - netatalk.git/blobdiff - etc/cnid_dbd/cmd_dbd_scanvol.c
chmod wrapper for onnv145+ to preserve ACL
[netatalk.git] / etc / cnid_dbd / cmd_dbd_scanvol.c
index 779c3c19dca8967ded126de11231fef58515870b..45d67ae1bd5b2c5dcfc09ce618fa3f95fb768372 100644 (file)
@@ -33,6 +33,7 @@
 #include <atalk/volume.h>
 #include <atalk/ea.h>
 #include <atalk/util.h>
+#include <atalk/acl.h>
 
 #include "cmd_dbd.h"
 #include "dbif.h"
@@ -57,6 +58,10 @@ static char           *netatalk_dirs[] = {
     ".AppleDesktop",
     NULL
 };
+static char           *special_dirs[] = {
+    ".zfs",
+    NULL
+};
 static struct cnid_dbd_rqst rqst;
 static struct cnid_dbd_rply rply;
 static jmp_buf jmp;
@@ -269,6 +274,21 @@ static const char *check_netatalk_dirs(const char *name)
     return NULL;
 }
 
+/*
+  Check for special names
+  Returns pointer to name or NULL.
+*/
+static const char *check_special_dirs(const char *name)
+{
+    int c;
+
+    for (c=0; special_dirs[c]; c++) {
+        if ((strcmp(name, special_dirs[c])) == 0)
+            return special_dirs[c];
+    }
+    return NULL;
+}
+
 /*
   Check for .AppleDouble file, create if missing
 */
@@ -858,12 +878,21 @@ static int dbd_readdir(int volroot, cnid_t did)
             continue;
         }
 
+        /* Check for special folders in volume root e.g. ".zfs" */
+        if (volroot) {
+            if ((name = check_special_dirs(ep->d_name)) != NULL) {
+                dbd_log(LOGSTD, "Ignoring special dir \"%s\"", name);
+                continue;
+            }
+        }
+
         /* Skip .AppleDouble dir in this loop */
         if (STRCMP(ep->d_name, == , ADv2_DIRNAME))
             continue;
 
         if ((ret = lstat(ep->d_name, &st)) < 0) {
-            dbd_log( LOGSTD, "Lost file while reading dir '%s/%s', probably removed: %s", cwdbuf, ep->d_name, strerror(errno));
+            dbd_log( LOGSTD, "Lost file while reading dir '%s/%s', probably removed: %s",
+                     cwdbuf, ep->d_name, strerror(errno));
             continue;
         }
         
@@ -1020,6 +1049,9 @@ static void delete_orphaned_cnids(DBD *dbd, DBD *dbd_rebuild, dbd_flags_t flags)
 
     /* Start main loop through dbd: get CNID from dbd */
     while ((dbif_idwalk(dbd, &dbd_cnid, 0)) == 1) {
+        /* Check if we got a termination signal */
+        if (alarmed)
+            longjmp(jmp, 1); /* this jumps back to cmd_dbd_scanvol() */
 
         if (deleted > 50) {
             deleted = 0;
@@ -1045,6 +1077,9 @@ static void delete_orphaned_cnids(DBD *dbd, DBD *dbd_rebuild, dbd_flags_t flags)
                         dbif_txn_close(dbd, ret);
                         deleted++;
                     }
+                    /* Check if we got a termination signal */
+                    if (alarmed)
+                        longjmp(jmp, 1); /* this jumps back to cmd_dbd_scanvol() */
                 }
                 return;
             } else