]> arthur.barton.de Git - netatalk.git/blobdiff - bin/ad/ad_rm.c
Merge master
[netatalk.git] / bin / ad / ad_rm.c
index f7f7a5759ec28f016da272356e0beeac9f0cd4df..b9ef2c3c2d941d11b8a0c7eba4227e0e4011a047 100644 (file)
@@ -212,7 +212,10 @@ static int rm(const char *path,
 
             /* Get CNID of Parent and add new childir to CNID database */
             pdid = did;
-            cnid = cnid_for_path(&volume, path, &did);
+            if ((cnid = cnid_for_path(&volume, path, &did)) == CNID_INVALID) {
+                SLOG("Error resolving CNID for %s", path);
+                return -1;
+            }
             if (cnid_delete(volume.volume.v_cdb, cnid) != 0) {
                 SLOG("Error removing CNID %u for %s", ntohl(cnid), path);
                 return -1;
@@ -245,7 +248,10 @@ static int rm(const char *path,
             }
 
             /* Get CNID of Parent and add new childir to CNID database */
-            did = cnid_for_path(&volume, path, &pdid);
+            if ((did = cnid_for_path(&volume, path, &pdid)) == CNID_INVALID) {
+                SLOG("Error resolving CNID for %s", path);
+                return -1;
+            }
             if (cnid_delete(volume.volume.v_cdb, did) != 0) {
                 SLOG("Error removing CNID %u for %s", ntohl(did), path);
                 return -1;
@@ -288,19 +294,17 @@ static int rm(const char *path,
 
             /* Get CNID of Parent and add new childir to CNID database */
             pdid = did;
-            cnid = cnid_for_path(&volume, path, &did);
+            if ((cnid = cnid_for_path(&volume, path, &did)) == CNID_INVALID) {
+                SLOG("Error resolving CNID for %s", path);
+                return -1;
+            }
             if (cnid_delete(volume.volume.v_cdb, cnid) != 0) {
                 SLOG("Error removing CNID %u for %s", ntohl(cnid), path);
                 return -1;
             }
 
-            if (!Rflag) {
-                if (volume.volume.vfs->vfs_deletefile(&volume.volume, -1, path) != 0) {
-                    SLOG("Error removing adouble file for: %s", path);
-                    badrm = rval = 1;
-                    break;
-                }
-            }
+            /* Ignore errors, because with -R adouble stuff is always alread gone */
+            volume.volume.vfs->vfs_deletefile(&volume.volume, -1, path);
         }
 
         if (unlink(path) != 0) {