Skip to content

Commit 59546e8

Browse files
groeckkuba-moo
authored andcommitted
selftests: net: Fix build warnings
Fix ksft.h: In function ‘ksft_ready’: ksft.h:27:9: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ ksft.h: In function ‘ksft_wait’: ksft.h:51:9: warning: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ by checking the return value of the affected functions and displaying an error message if an error is seen. Fixes: 2b6d490 ("selftests: drv-net: Factor out ksft C helpers") Cc: Joe Damato <jdamato@fastly.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Link: https://patch.msgid.link/20251205171010.515236-11-linux@roeck-us.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 06f7cae commit 59546e8

File tree

1 file changed

+4
-2
lines changed
  • tools/testing/selftests/net/lib

1 file changed

+4
-2
lines changed

tools/testing/selftests/net/lib/ksft.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ static inline void ksft_ready(void)
2424
fd = STDOUT_FILENO;
2525
}
2626

27-
write(fd, msg, sizeof(msg));
27+
if (write(fd, msg, sizeof(msg)) < 0)
28+
perror("write()");
2829
if (fd != STDOUT_FILENO)
2930
close(fd);
3031
}
@@ -48,7 +49,8 @@ static inline void ksft_wait(void)
4849
fd = STDIN_FILENO;
4950
}
5051

51-
read(fd, &byte, sizeof(byte));
52+
if (read(fd, &byte, sizeof(byte)) < 0)
53+
perror("read()");
5254
if (fd != STDIN_FILENO)
5355
close(fd);
5456
}

0 commit comments

Comments
 (0)