From 7a2ee1d6f6e5b9fd8c869726e30d952830145c27 Mon Sep 17 00:00:00 2001
From: Clemens Kirchgatterer <clemens@1541.org>
Date: Tue, 19 Mar 2019 09:14:28 +0100
Subject: [PATCH] workaround for FS implementations that do not support
 fflush()

https://github.com/espressif/arduino-esp32/issues/1293
---
 libraries/FS/src/vfs_api.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libraries/FS/src/vfs_api.cpp b/libraries/FS/src/vfs_api.cpp
index 2b91eb82187..6502f760560 100644
--- a/libraries/FS/src/vfs_api.cpp
+++ b/libraries/FS/src/vfs_api.cpp
@@ -340,6 +340,8 @@ void VFSFileImpl::flush()
         return;
     }
     fflush(_f);
+    // workaround for https://github.com/espressif/arduino-esp32/issues/1293
+    fsync(fileno(_f));
 }
 
 bool VFSFileImpl::seek(uint32_t pos, SeekMode mode)