From 3f519c7a1846a79e2662db7485bcaee7fe3d2605 Mon Sep 17 00:00:00 2001 From: DavidVentura Date: Mon, 6 Nov 2023 22:14:19 +0100 Subject: [PATCH] Open disk in O_SYNC mode when writing --- diskfs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diskfs.go b/diskfs.go index f2e39cf2..3ab39ce5 100644 --- a/diskfs.go +++ b/diskfs.go @@ -158,8 +158,8 @@ func (m OpenModeOption) String() string { var openModeOptions = map[OpenModeOption]int{ ReadOnly: os.O_RDONLY, - ReadWriteExclusive: os.O_RDWR | os.O_EXCL, - ReadWrite: os.O_RDWR, + ReadWriteExclusive: os.O_RDWR | os.O_EXCL | os.O_SYNC, + ReadWrite: os.O_RDWR | os.O_SYNC, } // SectorSize represents the sector size to use