]> arthur.barton.de Git - netatalk.git/commitdiff
Fix pathname bug for FCE modified event
authorFrank Lahm <franklahm@googlemail.com>
Fri, 9 Nov 2012 11:48:53 +0000 (12:48 +0100)
committerRalph Boehme <sloowfranklin@gmail.com>
Thu, 22 Nov 2012 15:19:52 +0000 (16:19 +0100)
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
etc/afpd/ofork.c

index 9c3ed7d2f1be64ce11c14b5814850195ca6c7742..54e1c1495c7f21b7547475a0b467adaa4df8aa5b 100644 (file)
@@ -22,6 +22,7 @@
 #include <atalk/logger.h>
 #include <atalk/util.h>
 #include <atalk/cnid.h>
+#include <atalk/bstrlib.h>
 #include <atalk/bstradd.h>
 #include <atalk/globals.h>
 #include <atalk/netatalk_conf.h>
index 66228b631bc6e510b9aee874693fe888948f93a9..3f5a42b01fcf0af851625178910bd54b3d5480c9 100644 (file)
@@ -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);