mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-18 17:00:35 +08:00
param_shmem: do fsync after param write
This commit is contained in:
@@ -857,7 +857,16 @@ param_save_default(void)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
// After writing the file, also do a fsync to prevent loosing params if power is cut.
|
||||
res = fsync(fd);
|
||||
if (res != 0) {
|
||||
PX4_ERR("failed to do fsync: %s", strerror(errno));
|
||||
goto exit;
|
||||
}
|
||||
|
||||
PARAM_CLOSE(fd);
|
||||
|
||||
|
||||
fd = -1;
|
||||
|
||||
exit:
|
||||
|
||||
Reference in New Issue
Block a user