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.
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 literals300
and100
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
Checklist: