LLNL / UnifyFS

UnifyFS: A file system for burst buffers
Other
99 stars 31 forks source link

Fix warning about too small buffer in write() call #786

Closed rgmiller closed 1 year ago

rgmiller commented 1 year ago

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

Checklist:

adammoody commented 1 year ago

Thanks, @rgmiller