fdatasync() patch for FreeBSD

  • From: Marcus von Appen <mva@xxxxxxxxxxxx>
  • To: emelfm2 <emelfm2@xxxxxxxxxxxxx>
  • Date: Fri, 24 Jul 2009 08:07:56 +0200

Hi,

in the recent SVN trunk and emelfm2 0.6.2 release, you are using a
fdatasync() call to flush a file after writing. FreeBSD does not have a
that call implemented and according to the POSIX specs it does not
differ much from the fsync() call.

Can e2_fs_writeflush() be changed to use fsync() instead (or #ifdef'd
for FreeBSD) without any impact on the rest of the writing behaviour?

Attached you'll find a patch for src/filesystem/e2_fs.c, which unbreaks
the FreeBSD build.

Regards
Marcus
Index: src/filesystem/e2_fs.c
===================================================================
--- src/filesystem/e2_fs.c      (revision 1814)
+++ src/filesystem/e2_fs.c      (working copy)
@@ -2570,7 +2570,7 @@
 gint e2_fs_writeflush (gint file_desc)
 {
        gint res;
-       res = fdatasync (file_desc);
+       res = fsync (file_desc);
        if (res == -1 && errno == EINVAL)
                res = 0;
        return res;

Other related posts: