]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/filedir.c
Fixes
[netatalk.git] / etc / afpd / filedir.c
index c5fbd10595964cef45cf91706f020fefa1ba607d..47b819f95255f09625054b9f0157944144f23649 100644 (file)
@@ -9,24 +9,7 @@
 
 #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>
 
@@ -397,6 +380,7 @@ static int moveandrename(const struct vol *vol,
         u_int16_t bshort;
 
         ad_getattr(adp, &bshort);
+        
         ad_close_metadata( adp);
         if ((bshort & htons(ATTRBIT_NORENAME))) {
             rc = AFPERR_OLOCK;
@@ -461,16 +445,11 @@ static int moveandrename(const struct vol *vol,
             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 */
@@ -611,7 +590,7 @@ int afp_delete(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size
             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);
             }