From c940df5a24b165f19a35d59fba6c62bcefbe6fd3 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Thu, 12 Jun 2014 21:53:17 +0200 Subject: [PATCH] Refactoring: move struct dir and dirlookup() to function scope Preperation for new feature to delete zero byte sized resource forks. Signed-off-by: Ralph Boehme Change-Id: ef5f88f5f2cefa75cf20d0ee447b4e20579a2f12 --- etc/afpd/ofork.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/afpd/ofork.c b/etc/afpd/ofork.c index 7c975c38..ec60e066 100644 --- a/etc/afpd/ofork.c +++ b/etc/afpd/ofork.c @@ -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); -- 2.39.2