[LTP] [PATCH] lib/tst_af_alg.c: Fix wrong errno for unsupported AF_ALG

Xiao Yang yangx.jy@cn.fujitsu.com
Tue Mar 19 04:25:02 CET 2019


According to socket(2) manpage and source code, socket(2) actually
returns EAFNOSUPPORT instead of EPROTONOSUPPORT when AF_ALG is not
supported by kernel.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 lib/tst_af_alg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tst_af_alg.c b/lib/tst_af_alg.c
index 9ce1ca4..97be548 100644
--- a/lib/tst_af_alg.c
+++ b/lib/tst_af_alg.c
@@ -16,7 +16,7 @@ int tst_alg_create(void)
 	TEST(socket(AF_ALG, SOCK_SEQPACKET, 0));
 	if (TST_RET >= 0)
 		return TST_RET;
-	if (TST_ERR == EPROTONOSUPPORT)
+	if (TST_ERR == EAFNOSUPPORT)
 		tst_brk(TCONF, "kernel doesn't support AF_ALG");
 	tst_brk(TBROK | TTERRNO, "unexpected error creating AF_ALG socket");
 	return -1;
-- 
1.8.3.1





More information about the ltp mailing list