mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 00:23:34 +08:00
param: grab the shutdown lock while writing params to the file
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
|
||||
#include <px4_defines.h>
|
||||
#include <px4_posix.h>
|
||||
#include <px4_shutdown.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@@ -158,6 +159,12 @@ out:
|
||||
|
||||
size_t buf_size = bson_encoder_buf_size(&encoder);
|
||||
|
||||
int shutdown_lock_ret = px4_shutdown_lock();
|
||||
|
||||
if (shutdown_lock_ret) {
|
||||
PX4_ERR("px4_shutdown_lock() failed (%i)", shutdown_lock_ret);
|
||||
}
|
||||
|
||||
/* Get a buffer from the flash driver with enough space */
|
||||
|
||||
uint8_t *buffer;
|
||||
@@ -186,6 +193,11 @@ out:
|
||||
free(enc_buff);
|
||||
parameter_flashfs_free();
|
||||
}
|
||||
|
||||
if (shutdown_lock_ret == 0) {
|
||||
px4_shutdown_unlock();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user