Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/net/socket.c: removed warnings from unused returns

socket.c: In function ‘run_tests’:
socket.c:59:25: warning: ignoring return value of ‘strerror_r’ \
declared with attribute ‘warn_unused_result’ [-Wunused-result]
59 | strerror_r(-s->expect, err_string1, ERR_STRING_SZ);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

socket.c:60:25: warning: ignoring return value of ‘strerror_r’ \
declared with attribute ‘warn_unused_result’ [-Wunused-result]
60 | strerror_r(errno, err_string2, ERR_STRING_SZ);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

socket.c:73:33: warning: ignoring return value of ‘strerror_r’ \
declared with attribute ‘warn_unused_result’ [-Wunused-result]
73 | strerror_r(errno, err_string1, ERR_STRING_SZ);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

changelog:
v2
- const char* messages and fixed patch warnings of max 75 chars
per line

Signed-off-by: Alex Tran <alex.t.tran@gmail.com>
Link: https://patch.msgid.link/20250819025227.239885-1-alex.t.tran@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Alex Tran and committed by
Jakub Kicinski
6b4b1d57 8f2c72f2

+6 -5
+6 -5
tools/testing/selftests/net/socket.c
··· 39 39 { 40 40 char err_string1[ERR_STRING_SZ]; 41 41 char err_string2[ERR_STRING_SZ]; 42 + const char *msg1, *msg2; 42 43 int i, err; 43 44 44 45 err = 0; ··· 57 56 errno == -s->expect) 58 57 continue; 59 58 60 - strerror_r(-s->expect, err_string1, ERR_STRING_SZ); 61 - strerror_r(errno, err_string2, ERR_STRING_SZ); 59 + msg1 = strerror_r(-s->expect, err_string1, ERR_STRING_SZ); 60 + msg2 = strerror_r(errno, err_string2, ERR_STRING_SZ); 62 61 63 62 fprintf(stderr, "socket(%d, %d, %d) expected " 64 63 "err (%s) got (%s)\n", 65 64 s->domain, s->type, s->protocol, 66 - err_string1, err_string2); 65 + msg1, msg2); 67 66 68 67 err = -1; 69 68 break; ··· 71 70 close(fd); 72 71 73 72 if (s->expect < 0) { 74 - strerror_r(errno, err_string1, ERR_STRING_SZ); 73 + msg1 = strerror_r(errno, err_string1, ERR_STRING_SZ); 75 74 76 75 fprintf(stderr, "socket(%d, %d, %d) expected " 77 76 "success got err (%s)\n", 78 77 s->domain, s->type, s->protocol, 79 - err_string1); 78 + msg1); 80 79 81 80 err = -1; 82 81 break;