]> arthur.barton.de Git - netatalk.git/commitdiff
Refactoring: move struct dir and dirlookup() to function scope
authorRalph Boehme <rb@sernet.de>
Thu, 12 Jun 2014 19:53:17 +0000 (21:53 +0200)
committerRalph Boehme <rb@sernet.de>
Wed, 18 Jun 2014 14:22:15 +0000 (16:22 +0200)
Preperation for new feature to delete zero byte sized resource forks.

Signed-off-by: Ralph Boehme <rb@sernet.de>
Change-Id: ef5f88f5f2cefa75cf20d0ee447b4e20579a2f12

etc/afpd/ofork.c

index 7c975c38f9ed581702e74827aaaf2c2d863e8ce7..ec60e066abfd72d508133d36dafc2af3b3290d9d 100644 (file)
@@ -389,6 +389,7 @@ int of_closefork(const AFPObj *obj, struct ofork *ofork)
     struct timeval      tv;
     int         adflags = 0;
     int                 ret;
+    struct dir *dir;
 
     adflags = 0;
     if (ofork->of_flags & AFPFORK_DATA)
@@ -405,9 +406,13 @@ int of_closefork(const AFPObj *obj, struct ofork *ofork)
         }
     }
 
+    dir = dirlookup(ofork->of_vol, ofork->of_did);
+    if (dir == NULL) {
+        LOG(log_debug, logtype_afpd, "dirlookup failed for %ju", (uintmax_t)ofork->of_did);
+    }
+
     /* Somone has used write_fork, we assume file was changed, register it to file change event api */
     if (ofork->of_flags & AFPFORK_MODIFIED) {
-        struct dir *dir =  dirlookup(ofork->of_vol, ofork->of_did);
         if (dir) {
             bstring forkpath = bformat("%s/%s", bdata(dir->d_fullpath), of_name(ofork));
             fce_register(FCE_FILE_MODIFY, bdata(forkpath), NULL, fce_file);