]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Portability fixes for FreeBSD - os_fdatasync()
authorRui Paulo <rpaulo@felyko.com>
Tue, 13 Oct 2015 10:41:07 +0000 (03:41 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 15 Oct 2015 13:14:30 +0000 (16:14 +0300)
Use fsync() when fdatasync() and F_FULLSYNC isn't available.

Signed-off-by: Rui Paulo <rpaulo@freebsd.org>
src/utils/os_unix.c

index ffa2e788b3db81e68a4b78d094cc95cad4807f03..8f8dc5b21a394c9e30d604133e41683f103d2358 100644 (file)
@@ -445,16 +445,16 @@ int os_file_exists(const char *fname)
 int os_fdatasync(FILE *stream)
 {
        if (!fflush(stream)) {
-#ifndef __MACH__
+#ifdef __linux__
                return fdatasync(fileno(stream));
-#else /* __MACH__ */
+#else /* !__linux__ */
 #ifdef F_FULLFSYNC
                /* OS X does not implement fdatasync(). */
                return fcntl(fileno(stream), F_FULLFSYNC);
 #else /* F_FULLFSYNC */
-#error Neither fdatasync nor F_FULLSYNC are defined
+               return fsync(fileno(stream));
 #endif /* F_FULLFSYNC */
-#endif /* __MACH__ */
+#endif /* __linux__ */
        }
 
        return -1;