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 <bjorn.andersson@linaro.org>
This commit is contained in:
Bjorn Andersson 2021-04-08 11:54:41 -05:00
parent 1cc12d3dc1
commit 293ab8babb

View File

@ -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",