Fix warning about too small buffer in write() call #786
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
#definesfor the test length and for a shorter test length and uses them instead of the integer literals300and100that 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
Checklist: