Wrap calls to fsync with skip_eintr.

GitOrigin-RevId: c7eaba54794d461428cce064e51be26909f39a30
This commit is contained in:
levlam 2019-07-03 17:51:00 +03:00
parent b8e8f337c2
commit 948da791ad

View File

@ -468,9 +468,9 @@ Status FileFd::sync() {
CHECK(!empty());
#if TD_PORT_POSIX
#if TD_DARWIN
if (fcntl(get_native_fd().fd(), F_FULLFSYNC) == -1) {
if (detail::skip_eintr([&] { return fcntl(get_native_fd().fd(), F_FULLFSYNC); }) == -1) {
#else
if (fsync(get_native_fd().fd()) != 0) {
if (detail::skip_eintr([&] { return fsync(get_native_fd().fd()); }) != 0) {
#endif
#elif TD_PORT_WINDOWS
if (FlushFileBuffers(get_native_fd().fd()) == 0) {