Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

"Use" fwrite result (workaround for warn_unused_result) #2187

Closed
wants to merge 1 commit into from

Conversation

BillyDonahue
Copy link
Contributor

Fixes #2185

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR

Comment on lines -158 to 161
(void)std::fwrite(full_message.data(), full_message.size(), 1, stderr);
if (std::fwrite(full_message.data(), full_message.size(), 1, stderr)) {
;
}
std::fputc('\n', stderr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't be trying to write \n if an error occurs which will also solve the warning:

  if (std::fwrite(full_message.data(), full_message.size(), 1, stderr) > 0)
    std::fputc('\n', stderr);

@vitaut
Copy link
Contributor

vitaut commented Mar 31, 2021

Merged with a small tweak.

@vitaut vitaut closed this Mar 31, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(void)fwrite triggers -Wunused-result again
2 participants