mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 09:13:32 +08:00
Use system define for path length buffer
This commit is contained in:
committed by
Daniel Agar
parent
2cabc4866a
commit
9e95d88574
@@ -49,6 +49,7 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <systemlib/err.h>
|
||||
@@ -82,6 +83,14 @@ static bool should_prearm = false;
|
||||
#define MIXER_DIFFERENCE_THRESHOLD 2
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#ifdef __PX4_NUTTX
|
||||
#define PATH_MAX 512
|
||||
#else
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_ARCH_BOARD_SITL)
|
||||
#define MIXER_PATH(_file) "/etc/mixers/"#_file
|
||||
#else
|
||||
@@ -206,7 +215,7 @@ bool MixerTest::loadAllTest()
|
||||
#endif
|
||||
if (strncmp(result->d_name, ".", 1) != 0) {
|
||||
|
||||
char buf[200];
|
||||
char buf[PATH_MAX];
|
||||
(void)strncpy(&buf[0], MIXER_ONBOARD_PATH, sizeof(buf));
|
||||
(void)strncpy(&buf[strlen(MIXER_ONBOARD_PATH)], result->d_name, sizeof(buf));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user