hiphi: gpt-utils: Do fsync after writing partition entries
Do fsync after writing partition entries to ensure data is actually written before rebooting device. Signed-off-by: 7Soldier <reg.fm4@gmail.com>
This commit is contained in:
parent
d668daaf63
commit
7e8fed40e2
1 changed files with 2 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue