Skip to content

Commit

Permalink
uorb: _POSIX_NAME_MAX -> NAME_MAX
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jnippula committed Sep 13, 2023
1 parent c801eb6 commit cc5098c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions platforms/common/uORB/uORBDeviceNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit cc5098c

Please sign in to comment.