* [LTP] [PATCH ltp] syscalls/bind02.c: Fix create socker failed for nobody user and nogroup for "Permission denied"
@ 2018-08-10 2:56 Zhanghui Yuan
2018-08-16 14:25 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Zhanghui Yuan @ 2018-08-10 2:56 UTC (permalink / raw)
To: ltp
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 <zhanghuix.yuan@intel.com>
---
testcases/kernel/syscalls/bind/bind02.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/bind/bind02.c b/testcases/kernel/syscalls/bind/bind02.c
index 90b0e9d8e..84ce588ce 100644
--- a/testcases/kernel/syscalls/bind/bind02.c
+++ b/testcases/kernel/syscalls/bind/bind02.c
@@ -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));
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [LTP] [PATCH ltp] syscalls/bind02.c: Fix create socker failed for nobody user and nogroup for "Permission denied"
2018-08-10 2:56 [LTP] [PATCH ltp] syscalls/bind02.c: Fix create socker failed for nobody user and nogroup for "Permission denied" Zhanghui Yuan
@ 2018-08-16 14:25 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2018-08-16 14:25 UTC (permalink / raw)
To: ltp
Hi!
> testcases/kernel/syscalls/bind/bind02.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/syscalls/bind/bind02.c b/testcases/kernel/syscalls/bind/bind02.c
> index 90b0e9d8e..84ce588ce 100644
> --- a/testcases/kernel/syscalls/bind/bind02.c
> +++ b/testcases/kernel/syscalls/bind/bind02.c
> @@ -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");
> + }
> }
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.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-16 14:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-10 2:56 [LTP] [PATCH ltp] syscalls/bind02.c: Fix create socker failed for nobody user and nogroup for "Permission denied" Zhanghui Yuan
2018-08-16 14:25 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox