]> arthur.barton.de Git - netatalk.git/commitdiff
Merge branch-2-1
authorFrank Lahm <franklahm@googlemail.com>
Fri, 29 Oct 2010 08:04:52 +0000 (10:04 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Fri, 29 Oct 2010 08:04:52 +0000 (10:04 +0200)
1  2 
NEWS
etc/afpd/filedir.c

diff --cc NEWS
Simple merge
index b537001309d6b69c3ab69f84cb16e1f52d29e155,2a862abeea7ecd2a6556fe267da5f41f9e29a70b..c5fbd10595964cef45cf91706f020fefa1ba607d
@@@ -406,19 -405,22 +411,22 @@@ static int moveandrename(const struct v
          }
      }
  
-     if (NULL == (upath = mtoupath(vol, newname, curdir->d_did, utf8_encoding()))){
-         return AFPERR_PARAM;
+     if (NULL == (upath = mtoupath(vol, newname, curdir->d_did, utf8_encoding()))){ 
+         rc = AFPERR_PARAM;
+         goto exit;
      }
      path.u_name = upath;
 -    st = &path.st;    
 +    st = &path.st;
      if (0 != (rc = check_name(vol, upath))) {
-         return  rc;
+         goto exit;
      }
  
      /* source == destination. we just silently accept this. */
 -    if ((!isdir && curdir == sdir) || (isdir && curdir == sdir->d_parent)) {
 +    if ((!isdir && curdir == sdir) || (isdir && curdir->d_did == sdir->d_pdid)) {
-         if (strcmp(oldname, newname) == 0)
-             return AFP_OK;
+         if (strcmp(oldname, newname) == 0) {
+             rc = AFP_OK;
+             goto exit;
+         }
  
          if (stat(upath, st) == 0 || caseenumerate(vol, &path, curdir) == 0) {
              if (!stat(p, &nst) && !(nst.st_dev == st->st_dev && nst.st_ino == st->st_ino) ) {
      }
      if ( rc == AFP_OK && id ) {
          /* renaming may have moved the file/dir across a filesystem */
-         if (stat(upath, st) < 0)
-             return AFPERR_MISC;
+         if (stat(upath, st) < 0) {
+             rc = AFPERR_MISC;
+             goto exit;
+         }
 +
 +        if (dir_modify(vol,
 +                       sdir,
 +                       curdir->d_did,
 +                       0,
 +                       newname,
 +                       upath,
 +                       S_ISDIR(st->st_mode) ? curdir->d_fullpath : NULL) != 0) {
 +            LOG(log_error, logtype_afpd, "moveandrename: dir_modify error: %s -> %s",
 +                p, upath);
 +            return AFPERR_MISC;
 +        }
 +
          /* fix up the catalog entry */
          cnid_update(vol->v_cdb, id, st, curdir->d_did, upath, strlen(upath));
      }