#include <stdio.h>
#include <stdlib.h>
-/* STDC check */
-#if STDC_HEADERS
#include <string.h>
-#else /* STDC_HEADERS */
-#ifndef HAVE_STRCHR
-#define strchr index
-#define strrchr index
-#endif /* HAVE_STRCHR */
-char *strchr (), *strrchr ();
-#ifndef HAVE_MEMCPY
-#define memcpy(d,s,n) bcopy ((s), (d), (n))
-#define memmove(d,s,n) bcopy ((s), (d), (n))
-#endif /* ! HAVE_MEMCPY */
-#endif /* STDC_HEADERS */
-
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
#include <errno.h>
#include <sys/param.h>
u_int16_t bshort;
ad_getattr(adp, &bshort);
+
ad_close_metadata( adp);
if ((bshort & htons(ATTRBIT_NORENAME))) {
rc = AFPERR_OLOCK;
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) {
+ LOG(log_warning, logtype_afpd,"Still cached: \"%s/%s\"", getcwdpath(), upath);
+ (void)dir_remove(vol, cacheddir);
}
/* fix up the catalog entry */
rc = deletefile(vol, -1, upath, 1);
struct dir *cachedfile;
- if ((cachedfile = dircache_search_by_name(vol, dir, upath, strlen(upath)))) {
+ if ((cachedfile = dircache_search_by_name(vol, dir, upath, strlen(upath), s_path->st.st_ctime))) {
dircache_remove(vol, cachedfile, DIRCACHE | DIDNAME_INDEX | QUEUE_INDEX);
dir_free(cachedfile);
}