aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorRui Paulo <rpaulo@felyko.com>2015-10-13 10:41:07 (GMT)
committerJouni Malinen <j@w1.fi>2015-10-15 13:14:30 (GMT)
commit22e8df3a982fc23ffb459a590685713df2c8e105 (patch)
tree1472b263d543953cf8a5ee1bdb2390a57d4e01fa /src/utils
parente8dc205f1710522ebc9a416140c32e8e15afd069 (diff)
downloadhostap-22e8df3a982fc23ffb459a590685713df2c8e105.zip
hostap-22e8df3a982fc23ffb459a590685713df2c8e105.tar.gz
hostap-22e8df3a982fc23ffb459a590685713df2c8e105.tar.bz2
Portability fixes for FreeBSD - os_fdatasync()
Use fsync() when fdatasync() and F_FULLSYNC isn't available. Signed-off-by: Rui Paulo <rpaulo@freebsd.org>
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/os_unix.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c
index ffa2e78..8f8dc5b 100644
--- a/src/utils/os_unix.c
+++ b/src/utils/os_unix.c
@@ -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;