]> arthur.barton.de Git - netatalk.git/commitdiff
dbd failed to convert appledouble files of symlinks
authorRalph Boehme <sloowfranklin@gmail.com>
Mon, 21 Jan 2013 14:06:39 +0000 (15:06 +0100)
committerRalph Boehme <sloowfranklin@gmail.com>
Mon, 21 Jan 2013 14:06:39 +0000 (15:06 +0100)
dbd simply skipped symlinks, fix this by possibly deleting the
appledouble file but still skip the CNID checks.

Also remove left-over rebuild db stuff which isn't used anymore since
the large dbd rewrite at 4913dbbc5b69642dacbe7302fc25d25f47e9c00c.

Fixes #490.

etc/cnid_dbd/cmd_dbd_scanvol.c
libatalk/adouble/ad_conv.c

index 48deb5f08d9c73dd34c40f89c23f2dae304afe4b..b9fbf3e88ac4d63bea0766caa4fef714b522ffee 100644 (file)
@@ -49,7 +49,6 @@
 
 static char           cwdbuf[MAXPATHLEN+1];
 static struct vol     *vol;
-static DBD            *dbd_rebuild;
 static dbd_flags_t    dbd_flags;
 static char           stamp[CNID_DEV_LEN];
 static char           *netatalk_dirs[] = {
@@ -686,10 +685,8 @@ static int dbd_readdir(int volroot, cnid_t did)
         switch (st.st_mode & S_IFMT) {
         case S_IFREG:
         case S_IFDIR:
-            break;
         case S_IFLNK:
-            dbd_log(LOGDEBUG, "Ignoring symlink %s/%s", cwdbuf, ep->d_name);
-            continue;
+            break;
         default:
             dbd_log(LOGSTD, "Bad filetype: %s/%s", cwdbuf, ep->d_name);
             if ( ! (dbd_flags & DBD_FLAGS_SCAN)) {
@@ -726,41 +723,21 @@ static int dbd_readdir(int volroot, cnid_t did)
         if (ADDIR_OK)
             adfile_ok = check_adfile(ep->d_name, &st, &name);
 
-        if (name == NULL) {
-            name = ep->d_name;
-        } else {
-            update_cnid(did, &st, ep->d_name, name);
-        }
+        if (!S_ISLNK(st.st_mode)) {
+            if (name == NULL) {
+                name = ep->d_name;
+            } else {
+                update_cnid(did, &st, ep->d_name, name);
+            }
 
-        /* Check CNIDs */
-        cnid = check_cnid(name, did, &st, adfile_ok);
+            /* Check CNIDs */
+            cnid = check_cnid(name, did, &st, adfile_ok);
 
-        /* Now add this object to our rebuild dbd */
-        if (cnid && dbd_rebuild) {
-            static uint count = 0;
-            rqst.cnid = rply.cnid;
-            ret = dbd_rebuild_add(dbd_rebuild, &rqst, &rply);
-            if (dbif_txn_close(dbd_rebuild, ret) != 0)
-                return -1;
-            if (rply.result != CNID_DBD_RES_OK) {
-                dbd_log( LOGSTD, "Fatal error adding CNID: %u for '%s/%s' to in-memory rebuild-db",
-                         cnid, cwdbuf, name);
-                return -1;
-            }
-            count++;
-            if (count == 10000) {
-                if (dbif_txn_checkpoint(dbd_rebuild, 0, 0, 0) < 0) {
-                    dbd_log(LOGSTD, "Error checkpointing!");
-                    return -1;
-                }
-                count = 0;
-            }
+            /* Check EA files */
+            if (vol->v_vfs_ea == AFPVOL_EA_AD)
+                check_eafiles(name);
         }
 
-        /* Check EA files */
-        if (vol->v_vfs_ea == AFPVOL_EA_AD)
-            check_eafiles(name);
-
         /**************************************************************************
           Recursion
         **************************************************************************/
index ff0eebcc497aa6c24ca5ca5320f8b1163ef7e340..a9fae763affc2874f5e52d11e956f665cd6b13d6 100644 (file)
@@ -173,9 +173,12 @@ static int ad_conv_v22ea(const char *path, const struct stat *sp, const struct v
 
     become_root();
 
-    EC_ZERO( ad_conv_v22ea_hf(path, sp, vol) );
-    EC_ZERO( ad_conv_v22ea_rf(path, sp, vol) );
+    if (ad_conv_v22ea_hf(path, sp, vol) != 0)
+        goto delete;
+    if (ad_conv_v22ea_rf(path, sp, vol) != 0)
+        goto delete;
 
+delete:
     EC_NULL( adpath = ad_path(path, adflags) );
     LOG(log_debug, logtype_ad,"ad_conv_v22ea_hf(\"%s\"): deleting adouble:v2 file: \"%s\"",
         path, fullpathname(adpath));