From 293ab8babb27ac0f24247bb101fed9420c629c29 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Thu, 8 Apr 2021 11:54:41 -0500 Subject: [PATCH] storage: Sync changes Open the storage devices as O_SYNC, to make sure modem writes aren't lingering in the event of power loss or sudden reboot. Signed-off-by: Bjorn Andersson --- storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage.c b/storage.c index 1cf0a3b..0f882eb 100644 --- a/storage.c +++ b/storage.c @@ -122,7 +122,7 @@ found: fspath = alloca(pathlen); snprintf(fspath, pathlen, "%s/%s", storage_dir, file); if (!storage_read_only) { - fd = open(fspath, O_RDWR); + fd = open(fspath, O_RDWR | O_SYNC); if (fd < 0) { saved_errno = errno; fprintf(stderr, "[storage] failed to open '%s' (requested '%s'): %s\n",