Skip to contentSkip to conversation

lib/tst_af_alg.c: Fix wrong errno for unsupported AF_ALG

PATCH New Xiao Yang 2 participants 3 messages Mar 19, 2019 – Mar 20, 2019 Library code

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 lib/tst_af_alg.c: Fix wrong errno for unsupported AF_ALG

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

---
 lib/tst_af_alg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/tst_af_alg.c +1 -1
index 9ce1ca4..97be548 100644
@@ -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;
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 lib/tst_af_alg.c: Fix wrong errno for unsupported AF_ALG

Quoted 30 lines · Xiao Yang

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

---
 lib/tst_af_alg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/tst_af_alg.c +1 -1
index 9ce1ca4..97be548 100644
@@ -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;
Signature · 7 lines
1.8.3.1




-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

Thanks, somehow I missed this.

author
#2 lore raw

PATCH 1/1 lib/tst_af_alg.c: Fix wrong errno for unsupported AF_ALG

Quoted 29 lines · Eric Biggers
Quoted 28 lines · Xiao Yang

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

---
  lib/tst_af_alg.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/tst_af_alg.c +1 -1
index 9ce1ca4..97be548 100644
@@ -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;
Signature · 1 line
1.8.3.1
Quoted 5 lines
Quoted 2 lines
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp

Thanks, somehow I missed this.

Hi Eric,

Pushed, thanks for your review. :-)

Best Regards,
Xiao Yang

Quoted 2 lines