OSDN Git Service

Fix crash on unmount under OSXFUSE.
[android-x86/external-exfat.git] / fuse / main.c
index 4bf553e..9f900ae 100644 (file)
@@ -157,9 +157,18 @@ static int fuse_exfat_release(const char* path, struct fuse_file_info* fi)
 static int fuse_exfat_fsync(const char* path, int datasync,
                struct fuse_file_info *fi)
 {
+       int rc;
+
        exfat_debug("[%s] %s", __func__, path);
-       exfat_flush_node(&ef, get_node(fi));
-       exfat_flush(&ef);
+       if (get_node(fi) != NULL)
+       {
+               rc = exfat_flush_node(&ef, get_node(fi));
+               if (rc != 0)
+                       return rc;
+       }
+       rc = exfat_flush(&ef);
+       if (rc != 0)
+               return rc;
        return exfat_fsync(ef.dev);
 }