]> arthur.ath.cx Git - netatalk.git/blobdiff - etc/afpd/ofork.c
Fix a crash in of_closefork(), bug #551
[netatalk.git] / etc / afpd / ofork.c
index cf77d4906ad6edaf0a8dc82c40ba6f75f378be0d..7c975c38f9ed581702e74827aaaf2c2d863e8ce7 100644 (file)
@@ -408,9 +408,11 @@ 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) {
         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);
+        if (dir) {
+            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);