Use system define for path length buffer

This commit is contained in:
Lorenz Meier
2017-01-02 16:39:46 +01:00
committed by Daniel Agar
parent 2cabc4866a
commit 9e95d88574
+10 -1
View File
@@ -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));