if (dir->d_flags & DIRF_CACHELOCK || dir->d_ofork) { /* 1 */
LOG(log_warning, logtype_afpd, "dir_remove(did:%u,'%s'): dir is locked or has opened forks",
- ntohl(dir->d_did), cfrombstr(dir->d_fullpath));
+ ntohl(dir->d_did), cfrombstr(dir->d_u_name));
return 0;
}
}
LOG(log_debug, logtype_afpd, "dir_remove(did:%u,'%s'): {removing}",
- ntohl(dir->d_did), cfrombstr(dir->d_fullpath));
+ ntohl(dir->d_did), cfrombstr(dir->d_u_name));
dircache_remove(vol, dir, DIRCACHE | DIDNAME_INDEX | QUEUE_INDEX); /* 3 */
dir_free(dir); /* 4 */
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;
+ /* Remove it from the cache */
+ struct dir *cacheddir = dircache_search_by_did(vol, id);
+ if (cacheddir == NULL) {
+ LOG(log_warning, logtype_afpd,"Not cached: \"%s/%s\"", getcwdpath(), upath);
+ rc = AFPERR_MISC;
+ goto exit;
}
+ (void)dir_remove(vol, cacheddir);
/* fix up the catalog entry */
cnid_update(vol->v_cdb, id, st, curdir->d_did, upath, strlen(upath));