-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid unused return value warning #168
Conversation
The whole change is in a Also #140 (comment) still applies. |
The warning is fixed in Linux: http://ci.ros2.org/view/packaging/job/packaging_linux/53/warnings17Result/fixed/ I don't know if the warning existed in OSX, the packaging job does not report anything, but the |
char * msg = strerror_r(errno, error_string, error_length); | ||
if (msg != error_string) { | ||
strncpy(error_string, msg, sizeof(error_string)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If msg
would be a string with 1024 or more characters and different from error_string
the strncpy
will make error_string
a non-null terminated string which will likely make the subsequent throw in line 135 explode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
b72c43a
to
a57c9b9
Compare
Can you please not trigger Windows jobs for this. |
#ifdef _GNU_SOURCE | ||
char * msg = strerror_r(errno, error_string, error_length); | ||
if (msg != error_string) { | ||
strncpy(error_string, msg, sizeof(error_string)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable error_length
already contains the value of sizeof(error_string)
.
Same next line.
@dirk-thomas duly noted. There weren't any jobs in the queue and nobody was using the Windows machine, so there was no harm in running the jobs anyway :-) |
a57c9b9
to
f0fd292
Compare
This should be ready for merging, the packaging jobs don't report the warning any more. |
lgtm |
Avoid unused return value warning
+1 |
remove obsolete INDENT-OFF usage
* adopt to changes in rclcpp::subscription Signed-off-by: Karsten Knese <karsten@openrobotics.org> * use init/fini function from introspection_ts Signed-off-by: Karsten Knese <karsten@openrobotics.org> * fix line length Signed-off-by: Karsten Knese <karsten@openrobotics.org>
This makes sure that the returned value of
strerror_r
is used.