syscalls/bind02.c: Fix create socker failed for nobody user and nogroup for "Permission denied"
PATCH 1/1 syscalls/bind02.c: Fix create socker failed for nobody user and nogroup for "Permission denied"
Socket will try to be bind by user: nobody, group: nobody and socket failed for "Permission denied" Add line 89~95 to fix this issue:
if (errno == EACCES) {
tst_resm(TPASS, "correct error");
return;
} else {
tst_brkm(TBROK | TERRNO, 0, "socket() failed");
}Signed-off-by Zhanghui Yuan <[email protected]>
--- testcases/kernel/syscalls/bind/bind02.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/bind/bind02.c +6 -1
@@ -86,7 +86,12 @@ void try_bind(void) }if ((sockfd =socket (AF_INET ,SOCK_STREAM ,0 )) <0 ) { -tst_brkm (TBROK |TERRNO ,0 ,"socket() failed" ); +if (errno ==EACCES ) { +tst_resm (TPASS ,"correct error" ); +return ; + }else { +tst_brkm (TBROK |TERRNO ,0 ,"socket() failed" ); + } }memset (&servaddr,0 ,sizeof (servaddr));
Signature · 1 line
2.17.1
PATCH 1/1 syscalls/bind02.c: Fix create socker failed for nobody user and nogroup for "Permission denied"
Hi!
Quoted 9 lines
testcases/kernel/syscalls/bind/bind02.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)testcases/kernel/syscalls/bind/bind02.c +0
-0@@ -86,7 +86,12 @@ void try_bind(void) }
testcases/kernel/syscalls/bind/bind02.c void try_bind(void) · line 95
Quoted 10 lines
testcases/kernel/syscalls/bind/bind02.c +6
-1if ((sockfd =socket (AF_INET ,SOCK_STREAM ,0 )) <0 ) { -tst_brkm (TBROK |TERRNO ,0 ,"socket() failed" ); +if (errno ==EACCES ) { +tst_resm (TPASS ,"correct error" ); +return ; + }else { +tst_brkm (TBROK |TERRNO ,0 ,"socket() failed" ); + } }
There is no good reason why shouldn't the nobody user be able to create AF_INET socket. Fist of all you should figure out why this is happening, then, if it turns out to be the test fault, we can do something about it.
Signature · 2 lines
Cyril Hrubis [email protected]