From e57b112e3e20af20dea7c621244fc358e4cc1401 Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Fri, 9 Nov 2012 12:48:53 +0100 Subject: [PATCH] Fix pathname bug for FCE modified event It's not guaranteed that cwd is the forks parent directory, thus we can't use the fullpathname(forkname) wrapper. Instead we use the DID stored in the ofork structure to dirlookup the directory and use it's fullpath together with the fork's name. --- etc/afpd/fork.c | 1 + etc/afpd/ofork.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/afpd/fork.c b/etc/afpd/fork.c index 9c3ed7d2..54e1c149 100644 --- a/etc/afpd/fork.c +++ b/etc/afpd/fork.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/etc/afpd/ofork.c b/etc/afpd/ofork.c index 66228b63..3f5a42b0 100644 --- a/etc/afpd/ofork.c +++ b/etc/afpd/ofork.c @@ -407,7 +407,10 @@ int of_closefork(const AFPObj *obj, struct ofork *ofork) /* Somone has used write_fork, we assume file was changed, register it to file change event api */ if (ofork->of_flags & AFPFORK_MODIFIED) { - fce_register(FCE_FILE_MODIFY, fullpathname(ofork->of_ad->ad_name), NULL, fce_file); + struct dir *dir = dirlookup(ofork->of_vol, ofork->of_did); + bstring forkpath = bformat("%s/%s", bdata(dir->d_fullpath), of_name(ofork)); + fce_register(FCE_FILE_MODIFY, bdata(forkpath), NULL, fce_file); + bdestroy(forkpath); } ad_unlock(ofork->of_ad, ofork->of_refnum, ofork->of_flags & AFPFORK_ERROR ? 0 : 1); -- 2.39.2