]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/enumerate.c
fce: afpd: missing includes and fix SIGCLD handler argument list
[netatalk.git] / etc / afpd / enumerate.c
index 80141e801850fa54f047c28dfd57fcadc108289a..340f79aed6738676acd8341f7c1d7a46171324da 100644 (file)
@@ -346,15 +346,9 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_,
             sd.sd_last += len + 1;
             continue;
         }
-        memset(&s_path, 0, sizeof(s_path));
 
-        /* conversions on the fly */
-        const char *convname;
+        memset(&s_path, 0, sizeof(s_path));
         s_path.u_name = sd.sd_last;
-        if (ad_convert(sd.sd_last, &s_path.st, vol, &convname) == 0 && convname) {
-            s_path.u_name = (char *)convname;
-        }
-
         if (of_stat(vol, &s_path) < 0 ) {
             /* so the next time it won't try to stat it again
              * another solution would be to invalidate the cache with 
@@ -366,12 +360,21 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_,
             continue;
         }
 
-        /* Fixup CNID db if ad_convert resulted in a rename (then convname != NULL) */
-        if (convname) {
-            s_path.id = cnid_lookup(vol->v_cdb, &s_path.st, curdir->d_did, sd.sd_last, strlen(sd.sd_last));
-            if (s_path.id != CNID_INVALID) {
-                if (cnid_update(vol->v_cdb, s_path.id, &s_path.st, curdir->d_did, (char *)convname, strlen(convname)) != 0)
-                    LOG(log_error, logtype_afpd, "enumerate: error updating CNID of \"%s\"", fullpathname(convname));
+        /* conversions on the fly */
+        const char *convname;
+        if (ad_convert(sd.sd_last, &s_path.st, vol, &convname) == 0) {
+            if (convname) {
+                s_path.u_name = (char *)convname;
+                AFP_CNID_START("cnid_lookup");
+                s_path.id = cnid_lookup(vol->v_cdb, &s_path.st, curdir->d_did, sd.sd_last, strlen(sd.sd_last));
+                AFP_CNID_DONE();
+                if (s_path.id != CNID_INVALID) {
+                    AFP_CNID_START("cnid_update");
+                    int cnid_up_ret = cnid_update(vol->v_cdb, s_path.id, &s_path.st, curdir->d_did, (char *)convname, strlen(convname));
+                    AFP_CNID_DONE();
+                    if (cnid_up_ret != 0)
+                        LOG(log_error, logtype_afpd, "enumerate: error updating CNID of \"%s\"", fullpathname(convname));
+                }
             }
         }