mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-17 04:10:35 +08:00
fix param: need to use fsync() and not px4_fsync()
It's used with real OS FD's.
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
#include "tinybson.h"
|
||||
|
||||
#if 0
|
||||
# define debug(fmt, args...) do { warnx("BSON: " fmt, ##args); } while(0)
|
||||
# define debug(fmt, args...) do { PX4_INFO("BSON: " fmt, ##args); } while(0)
|
||||
#else
|
||||
# define debug(fmt, args...) do { } while(0)
|
||||
#endif
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
#define BSON_READ read
|
||||
#define BSON_WRITE write
|
||||
#define BSON_FSYNC px4_fsync
|
||||
#define BSON_FSYNC fsync
|
||||
|
||||
static int
|
||||
read_x(bson_decoder_t decoder, void *p, size_t s)
|
||||
|
||||
@@ -1140,14 +1140,14 @@ param_export(int fd, bool only_unsaved)
|
||||
out:
|
||||
|
||||
if (result == 0) {
|
||||
result = bson_encoder_fini(&encoder); // this will call fsync
|
||||
result = bson_encoder_fini(&encoder);
|
||||
|
||||
// write and finish
|
||||
if ((result != 0) || write(fd, encoder.buf, encoder.bufpos) != encoder.bufpos) {
|
||||
PX4_ERR("param write error");
|
||||
|
||||
} else {
|
||||
px4_fsync(fd);
|
||||
fsync(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user