Skip to content

Conversation

@rgmiller
Copy link
Contributor

Fix a warning about a write() call having too small a buffer for the number of bytes it was supposed to write.

Also replaced a pair of literal numbers that were used repeatedly with #defines.

Resolves issue #782

Description

Simple bug fix: use the already existing buffer as the source for a write() call instead of the too short string literal.

This change adds #defines for the test length and for a shorter test length and uses them instead of the integer literals 300 and 100 that are sprinkled throughout the function.

Motivation and Context

Newer versions of GCC (starting with at least v11.3.0 and possibly earlier) issue a warning because of this bug. Since the default for UnifyFS is to compile with -Werror, that warning aborts the build. See issue #782.

How Has This Been Tested?

Re-compile and note that the warning goes away.
Re-run the unit tests and make sure the changed test still passes and all the printed messages look correct.

Types of changes

  • [x ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • [x ] Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Testing (addition of new tests or update to current tests)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • [x ] My code follows the UnifyFS code style requirements.
  • I have updated the documentation accordingly.
  • [x ] I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • [x ] All new and existing tests passed.
  • [x ] All commit messages are properly formatted.

Fix a warning about a write() call having too small a buffer for the
number of bytes it was supposed to write.

Also replaced a pair of literal numbers that were used repeatedly with
 #defines.

Resolves issue llnl#782
@adammoody adammoody merged commit ffe0a96 into llnl:dev Jul 17, 2023
@adammoody
Copy link
Collaborator

Thanks, @rgmiller

@rgmiller rgmiller deleted the 782_write_buffer_size branch July 24, 2023 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants