]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/filedir.c
Fix another error in moveandrename introduce probably because the *at func cleanup...
[netatalk.git] / etc / afpd / filedir.c
index 0e9c367023a7161dcb2f4c3dfff7c30b7577bbcd..c16ba484e34cf3c17e470c08af057a450d4878d5 100644 (file)
@@ -351,22 +351,24 @@ static int moveandrename(const struct vol *vol,
     if (!isdir) {
         if ((oldunixname = strdup(mtoupath(vol, oldname, sdir->d_did, utf8_encoding()))) == NULL)
             return AFPERR_PARAM; /* can't convert */
+        id = cnid_get(vol->v_cdb, sdir->d_did, oldunixname, strlen(oldunixname));
 
 #ifndef HAVE_ATFUNCS
         /* Need full path */
-        id = cnid_get(vol->v_cdb, sdir->d_did, p, strlen(p));
-        p = ctoupath( vol, sdir, oldname );
-        if (!p)
+        free(oldunixname);
+        if ((oldunixname = strdup(ctoupath(vol, sdir, oldname))) == NULL)
             return AFPERR_PARAM; /* pathname too long */
 #endif /* HAVE_ATFUNCS */
 
         path.st_valid = 0;
         path.u_name = oldunixname;
+
 #ifdef HAVE_ATFUNCS
         opened = of_findnameat(sdir_fd, &path);
 #else
         opened = of_findname(&path);
 #endif /* HAVE_ATFUNCS */
+
         if (opened) {
             /* reuse struct adouble so it won't break locks */
             adp = opened->of_ad;
@@ -378,8 +380,6 @@ static int moveandrename(const struct vol *vol,
         adflags = ADFLAGS_DIR;
     }
 
-    LOG(log_debug, logtype_afpd, "oldunixname: \"%s\"", oldunixname);
-
     /*
      * oldunixname now points to either
      *   a) full pathname of the source fs object (if renameat is not available)
@@ -445,8 +445,6 @@ static int moveandrename(const struct vol *vol,
         goto exit;
     }
 
-    LOG(log_debug, logtype_afpd, "oldunixname: \"%s\"", oldunixname);
-
     if ( !isdir ) {
         path.st_valid = 1;
         path.st_errno = errno;