]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/dircache.c
Removing ressource fork AppleDouble fails, bug #542
[netatalk.git] / etc / afpd / dircache.c
index 5a702fa55bfd125f943c4ce37bf12ff4ba8524d5..c145616b314887ea15bcdc7b0327ae9d3b7e1cb7 100644 (file)
@@ -324,7 +324,7 @@ struct dir *dircache_search_by_did(const struct vol *vol, cnid_t cnid)
             return NULL;        /* (1b) */
 
         }
-        if (lstat(cfrombstr(cdir->d_fullpath), &st) != 0) {
+        if (ostat(cfrombstr(cdir->d_fullpath), &st, vol_syml_opt(vol)) != 0) {
             LOG(log_debug, logtype_afpd, "dircache(cnid:%u): {missing:\"%s\"}",
                 ntohl(cnid), cfrombstr(cdir->d_fullpath));
             (void)dir_remove(vol, cdir);
@@ -394,7 +394,7 @@ struct dir *dircache_search_by_name(const struct vol *vol,
     }
 
     if (cdir) {
-        if (lstat(cfrombstr(cdir->d_fullpath), &st) != 0) {
+        if (ostat(cfrombstr(cdir->d_fullpath), &st, vol_syml_opt(vol)) != 0) {
             LOG(log_debug, logtype_afpd, "dircache(did:%u,\"%s\"): {missing:\"%s\"}",
                 ntohl(dir->d_did), name, cfrombstr(cdir->d_fullpath));
             (void)dir_remove(vol, cdir);
@@ -434,7 +434,6 @@ struct dir *dircache_search_by_name(const struct vol *vol,
 int dircache_add(const struct vol *vol,
                  struct dir *dir)
 {
-    struct dir *cdir = NULL;
     struct dir key;
     hnode_t *hn;
 
@@ -462,7 +461,7 @@ int dircache_add(const struct vol *vol,
         dircache_stat.expunged++;
     }
     key.d_vid = vol->v_vid;
-    key.d_pdid = dir->d_did;
+    key.d_pdid = dir->d_pdid;
     key.d_u_name = dir->d_u_name;
     if ((hn = hash_lookup(index_didname, &key))) {
         /* Found an entry with the same DID/name, delete it */
@@ -557,7 +556,7 @@ void dircache_remove(const struct vol *vol _U_, struct dir *dir, int flags)
  * - a DID/name index on the main dircache
  * - a queue index on the dircache
  *
- * @param size   (r) requested maximum size from afpd.conf
+ * @param size   (r) requested maximum size from afp.conf
  *
  * @return 0 on success, -1 on error
  */
@@ -594,6 +593,7 @@ int dircache_init(int reqsize)
     rootParent.d_fullpath = bfromcstr("ROOT_PARENT");
     rootParent.d_m_name = bfromcstr("ROOT_PARENT");
     rootParent.d_u_name = rootParent.d_m_name;
+    rootParent.d_rights_cache = 0xffffffff;
 
     return 0;
 }
@@ -692,5 +692,6 @@ void dircache_dump(void)
 
     fprintf(dump, "\n");
     fflush(dump);
+    fclose(dump);
     return;
 }