🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Omokefe Emmanuel Onanaroghene Fri, 20 Nov 2026 00:51
[PATCH net-next] selftests: net: socket: fix inverted failure diagnostic
#19523
Author: Omokefe Emmanuel Onanaroghene
Date: Fri, 20 Nov 2026 00:51
32 lines
11754 bytes
When socket() succeeds but the test case expected failure, the error
branch prints "expected success got err" with strerror(errno), both
backwards (reality is "expected err, got success") and stale (errno is
meaningless after a successful call). Mirror the sibling fd<0 branch:
name the expected errno via strerror(-s->expect).

Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>
---
 tools/testing/selftests/net/socket.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/socket.c b/tools/testing/selftests/net/socket.c
index 9e270548dad80..7f075acc0b19c 100644
--- a/tools/testing/selftests/net/socket.c
+++ b/tools/testing/selftests/net/socket.c
@@ -71,10 +71,11 @@ static int run_tests(void)
 			close(fd);
 
 			if (s->expect < 0) {
-				msg1 = strerror_r(errno, err_string1, ERR_STRING_SZ);
+				msg1 = strerror_r(-s->expect, err_string1,
+						  ERR_STRING_SZ);
 
 				fprintf(stderr, "socket(%d, %d, %d) expected "
-					"success got err (%s)\n",
+					"err (%s) got success\n",
 					s->domain, s->type, s->protocol,
 					msg1);
 
-- 
2.43.0
Re: [PATCH net-next] selftests: net: socket: fix inverted failure diagnostic
#23921
Author: Simon Horman
Date: Sat, 28 Nov 2026 15:17
11 lines
8216 bytes
On Fri, Nov 20, 2026 at 01:51:02AM +0100, Omokefe Emmanuel Onanaroghene wrote:
> When socket() succeeds but the test case expected failure, the error
> branch prints "expected success got err" with strerror(errno), both
> backwards (reality is "expected err, got success") and stale (errno is
> meaningless after a successful call). Mirror the sibling fd<0 branch:
> name the expected errno via strerror(-s->expect).
> 
> Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>

Reviewed-by: Simon Horman <horms@kernel.org>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads