testsuites/fstests: Fix the tftpfs read loop

The read loop is bounded by a byte budget of type size_t.  Every test
passes SIZE_MAX to say that there is no budget.  Commit bd2055cf5a
cast the budget to ssize_t to silence a sign compare warning, which
turned SIZE_MAX into -1, so the loop condition was false right away
and read() was never called.

Cast the loop variable instead.  It is positive by the first operand
of the condition, so the cast preserves its value.

Close #5713.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
Sebastian Huber authored and Vijay Banerjee committed 2026-08-19 15:03:24 +00:00
1 parent 330abdc6a8
commit aa4eaaceed
1 file changed
+1 -1
+1 -1
View File
@@ -347,7 +347,7 @@ static int read_tftp_file(
if ( *fd >= 0 ) {
data_buffer = malloc( buffer_size );
while ( bytes > 0 && (ssize_t) max_bytes >= bytes ) {
while ( bytes > 0 && max_bytes >= (size_t) bytes ) {
errno = 0;
bytes = read(
*fd,