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;
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)
goto exit;
}
- LOG(log_debug, logtype_afpd, "oldunixname: \"%s\"", oldunixname);
-
if ( !isdir ) {
path.st_valid = 1;
path.st_errno = errno;
(void)dir_remove(vol, cacheddir);
}
+ /* Fixup adouble info */
+ if (!ad_metadata(upath, adflags, adp)) {
+ ad_setid(adp, st->st_dev, st->st_ino, id, curdir->d_did, vol->v_stamp);
+ ad_flush(adp);
+ ad_close_metadata(adp);
+ }
+
/* fix up the catalog entry */
cnid_update(vol->v_cdb, id, st, curdir->d_did, upath, strlen(upath));
}
rc = deletefile(vol, -1, upath, 1);
struct dir *cachedfile;
- if ((cachedfile = dircache_search_by_name(vol, dir, upath, strlen(upath), s_path->st.st_ctime))) {
+ if ((cachedfile = dircache_search_by_name(vol, dir, upath, strlen(upath)))) {
dircache_remove(vol, cachedfile, DIRCACHE | DIDNAME_INDEX | QUEUE_INDEX);
dir_free(cachedfile);
}
}
}
if ( rc == AFP_OK ) {
- curdir->offcnt--;
+ curdir->d_offcnt--;
setvoltime(obj, vol );
}
rc = AFPERR_PARAM;
goto exit;
}
- curdir->offcnt++;
- sdir->offcnt--;
+ curdir->d_offcnt++;
+ sdir->d_offcnt--;
#ifdef DROPKLUDGE
if (vol->v_flags & AFPVOL_DROPBOX) {
/* FIXME did is not always the source id */