sm6375-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: Ia2067d5e215b60290165b0dfd4ba842434343058
This commit is contained in:
Arian
2022-03-04 17:35:33 -03:00
committed by Ramii Ahmed
parent af1bf5c16c
commit 978e34ed26

View File

@@ -1374,7 +1374,7 @@ int gpt_disk_get_disk_info(const char *dev, struct gpt_disk *dsk)
dev);
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: