From cc5098c8dc662e55a4aec82da7daec7d1f7a5ee0 Mon Sep 17 00:00:00 2001 From: Jari Nippula Date: Wed, 13 Sep 2023 09:22:19 +0300 Subject: [PATCH] uorb: _POSIX_NAME_MAX -> NAME_MAX In SITL case the _POSIX_NAME_MAX is only 14, so it fails for every topic. Use NAME_MAX instead to get correct maximum filename value for both posix and nuttx cases. --- platforms/common/uORB/uORBDeviceNode.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platforms/common/uORB/uORBDeviceNode.cpp b/platforms/common/uORB/uORBDeviceNode.cpp index 50dd2cc4ac11..295d6ab3b9a7 100644 --- a/platforms/common/uORB/uORBDeviceNode.cpp +++ b/platforms/common/uORB/uORBDeviceNode.cpp @@ -259,8 +259,9 @@ orb_advert_t uORB::DeviceNode::nodeOpen(const ORB_ID id, const uint8_t instance, int ret = uORB::Utils::node_mkpath(nodepath, get_orb_meta(id), &inst); bool created = false; - if (ret == -ENAMETOOLONG || strlen(nodepath) > _POSIX_NAME_MAX) { - PX4_ERR("Device node name too long! '%s'", get_orb_meta(id)->o_name); + if (ret == -ENAMETOOLONG || strlen(nodepath) > NAME_MAX) { + PX4_ERR("Device node name too long! '%s' (len: %lu vs. NAME_MAX: %lu)", + get_orb_meta(id)->o_name, ((long unsigned int) strlen(nodepath)), ((long unsigned int) NAME_MAX)); } if (ret != OK) {