Skip to content
Snippets Groups Projects
Commit fa34ced5 authored by Benergy Meenan Ravuri's avatar Benergy Meenan Ravuri Committed by Arian
Browse files

sm8350-common: gpt-utils: Do fsync after writing partition entries

Do fsync after writing partition entries to ensure data
is actually written before rebooting device.

Change-Id: I09659cab247fe280dc608e30a88d912034cbc01a
parent 91901dee
No related branches found
No related tags found
No related merge requests found
...@@ -1478,7 +1478,7 @@ int gpt_disk_commit(struct gpt_disk *disk) ...@@ -1478,7 +1478,7 @@ int gpt_disk_commit(struct gpt_disk *disk)
ALOGE("%s: Invalid args", __func__); ALOGE("%s: Invalid args", __func__);
goto error; goto error;
} }
fd = open(disk->devpath, O_RDWR); fd = open(disk->devpath, O_RDWR | O_DSYNC);
if (fd < 0) { if (fd < 0) {
ALOGE("%s: Failed to open %s: %s", ALOGE("%s: Failed to open %s: %s",
__func__, __func__,
...@@ -1510,6 +1510,7 @@ int gpt_disk_commit(struct gpt_disk *disk) ...@@ -1510,6 +1510,7 @@ int gpt_disk_commit(struct gpt_disk *disk)
__func__); __func__);
goto error; goto error;
} }
fsync(fd);
close(fd); close(fd);
return 0; return 0;
error: error:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment