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
This commit is contained in:
Benergy Meenan Ravuri 2021-07-12 23:27:12 +05:30 committed by Arian
parent 91901deedc
commit fa34ced5a5

View File

@ -1478,7 +1478,7 @@ int gpt_disk_commit(struct gpt_disk *disk)
ALOGE("%s: Invalid args", __func__);
goto error;
}
fd = open(disk->devpath, O_RDWR);
fd = open(disk->devpath, O_RDWR | O_DSYNC);
if (fd < 0) {
ALOGE("%s: Failed to open %s: %s",
__func__,
@ -1510,6 +1510,7 @@ int gpt_disk_commit(struct gpt_disk *disk)
__func__);
goto error;
}
fsync(fd);
close(fd);
return 0;
error: