]> arthur.barton.de Git - netatalk.git/commitdiff
bugfix: cache handling when inodes are reused.
authordidg <didg>
Wed, 16 Apr 2003 06:55:44 +0000 (06:55 +0000)
committerdidg <didg>
Wed, 16 Apr 2003 06:55:44 +0000 (06:55 +0000)
etc/afpd/directory.c
etc/afpd/enumerate.c

index 6d3fe1bd47493497833539d9f449014114cc6cc5..1dc0c51cae44dd51621ce47262ce2037105cb360 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.67 2003-04-15 07:18:45 didg Exp $
+ * $Id: directory.c,v 1.68 2003-04-16 06:55:44 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -407,10 +407,7 @@ struct dir *dir;
 
     /* i'm not sure if it really helps to delete stuff. */
 #ifndef REMOVE_NODES 
-    if (dir->d_u_name != dir->d_m_name) {
-        free(dir->d_u_name);
-    }
-    free(dir->d_m_name);
+    dirfreename(dir);
     dir->d_m_name = NULL;
     dir->d_u_name = NULL;
 #else /* ! REMOVE_NODES */
index 61b578a2db07a72e907ff5effb54b4c0c08a7437..469d1bce2540240c4c34e3286c1063177d623ce8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: enumerate.c,v 1.37 2003-03-15 01:34:35 didg Exp $
+ * $Id: enumerate.c,v 1.38 2003-04-16 06:55:44 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -48,6 +48,7 @@ struct path     *path;
     char        *name;
     char        *upath;
     struct stat *st;
+    int         deleted;
 
     upath = path->u_name;
     name  = path->m_name;    
@@ -75,15 +76,17 @@ struct path     *path;
            - it's an ID reused as above
            - it's a hash duplicate and we are in big trouble
         */
+        deleted = (edir->d_m_name == NULL);
         dirfreename(edir);
         edir->d_m_name = cdir->d_m_name;
         edir->d_u_name = cdir->d_u_name;
         free(cdir);
         cdir = edir;
-        if (!cdir->d_parent || cdir->d_parent == dir)
+        if (!cdir->d_parent || (cdir->d_parent == dir && !deleted))
             return cdir;
         /* the old was not in the same folder */
-       dirchildremove(cdir->d_parent, cdir);
+        if (!deleted)
+            dirchildremove(cdir->d_parent, cdir);
     }
 
     /* parent/child directories */