mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 16:07:34 +08:00
mavlink fix for cause of intermittent crash
If the posix target is run and the rootfs is not created, then there is an fopen in mavlink without a return value check and then a write to the fd. When this condition occurs it tries to write to NULL and will segfault. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
committed by
Lorenz Meier
parent
a1b68b5b41
commit
e6d9aa2b43
@@ -409,9 +409,14 @@ protected:
|
||||
snprintf(log_file_path, sizeof(log_file_path), PX4_ROOTFSDIR"/fs/microsd/%s", log_file_name);
|
||||
fp = fopen(log_file_path, "ab");
|
||||
|
||||
/* write first message */
|
||||
fputs(msg.text, fp);
|
||||
fputs("\n", fp);
|
||||
if (fp != NULL) {
|
||||
/* write first message */
|
||||
fputs(msg.text, fp);
|
||||
fputs("\n", fp);
|
||||
}
|
||||
else {
|
||||
warn("Failed to open %s errno=%d", log_file_path, errno);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user