SITL: quieten MKFIFO warning in case of EEXIST

This commit is contained in:
Peter Barker 2021-11-12 08:30:30 +11:00 committed by Peter Barker
parent 5e18f98b8e
commit 60453b2250
2 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#if HAL_SIM_GPS_EXTERNAL_FIFO_ENABLED #if HAL_SIM_GPS_EXTERNAL_FIFO_ENABLED
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h>
#include <AP_HAL_SITL/AP_HAL_SITL.h> #include <AP_HAL_SITL/AP_HAL_SITL.h>
extern const HAL_SITL& hal_sitl; extern const HAL_SITL& hal_sitl;
#endif #endif
@ -45,7 +46,9 @@ GPS::GPS(uint8_t _instance) :
AP_BoardConfig::allocation_error("gps_fifo filepath"); AP_BoardConfig::allocation_error("gps_fifo filepath");
} }
if (mkfifo(_gps_fifo, 0666) < 0) { if (mkfifo(_gps_fifo, 0666) < 0) {
printf("MKFIFO failed with %m\n"); if (errno != EEXIST) {
printf("MKFIFO failed with %m\n");
}
} }
#endif #endif
} }

View File

@ -42,6 +42,8 @@ namespace SITL {
class GPS : public SerialDevice { class GPS : public SerialDevice {
public: public:
CLASS_NO_COPY(GPS);
enum Type { enum Type {
NONE = 0, NONE = 0,
UBLOX = 1, UBLOX = 1,