All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhao Gongyi <zhaogongyi@huawei.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/bind01: Close/recreate inet_socket after calling bind() successed
Date: Thu, 22 Apr 2021 21:54:05 +0800	[thread overview]
Message-ID: <20210422135405.14269-1-zhaogongyi@huawei.com> (raw)

When the test running with -i option to run more than one time,
it will fail because of calling bind successed more than one time,
as follows:

#bind01 -i 2
tst_test.c:1313: TINFO: Timeout per run is 0h 05m 00s
bind01.c:52: TPASS: invalid salen: EINVAL (22)
bind01.c:52: TPASS: invalid socket: ENOTSOCK (88)
bind01.c:55: TPASS: INADDR_ANYPORT passed
bind01.c:52: TPASS: UNIX-domain of current directory: EAFNOSUPPORT (97)
bind01.c:52: TPASS: non-local address: EADDRNOTAVAIL (99)
bind01.c:52: TPASS: invalid salen: EINVAL (22)
bind01.c:52: TPASS: invalid socket: ENOTSOCK (88)
bind01.c:55: TFAIL: INADDR_ANYPORT failed: EINVAL (22)
bind01.c:52: TPASS: UNIX-domain of current directory: EAFNOSUPPORT (97)
bind01.c:52: TPASS: non-local address: EADDRNOTAVAIL (99)

Summary:
passed   9
failed   1
broken   0
skipped  0
warnings 0

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 testcases/kernel/syscalls/bind/bind01.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/bind/bind01.c b/testcases/kernel/syscalls/bind/bind01.c
index 758d12863..c008819a8 100644
--- a/testcases/kernel/syscalls/bind/bind01.c
+++ b/testcases/kernel/syscalls/bind/bind01.c
@@ -53,6 +53,8 @@ void verify_bind(unsigned int nr)
 	} else {
 		TST_EXP_PASS(bind(*tcase->socket_fd, tcase->sockaddr, tcase->salen),
 		             "%s", tcase->desc);
+		SAFE_CLOSE(inet_socket);
+		inet_socket = SAFE_SOCKET(PF_INET, SOCK_STREAM, 0);
 	}
 }

--
2.17.1


             reply	other threads:[~2021-04-22 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 13:54 Zhao Gongyi [this message]
2021-04-22 14:27 ` [LTP] [PATCH] syscalls/bind01: Close/recreate inet_socket after calling bind() successed Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210422135405.14269-1-zhaogongyi@huawei.com \
    --to=zhaogongyi@huawei.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.