io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ammar Faizi <ammarfaizi2@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Ammar Faizi <ammarfaizi2@gmail.com>,
	io_uring Mailing List <io-uring@vger.kernel.org>
Subject: [PATCH liburing v2 2/2] test/accept-link: Add `srand()` for better randomness
Date: Mon, 27 Sep 2021 20:40:23 +0700	[thread overview]
Message-ID: <20210927134023.294466-3-ammarfaizi2@gmail.com> (raw)
In-Reply-To: <20210927134023.294466-1-ammarfaizi2@gmail.com>

The use of `rand()` should be accompanied by `srand()`.

Signed-off-by: Ammar Faizi <ammarfaizi2@gmail.com>
---
 test/accept-link.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/accept-link.c b/test/accept-link.c
index f111275..68db5be 100644
--- a/test/accept-link.c
+++ b/test/accept-link.c
@@ -240,6 +240,9 @@ int main(int argc, char *argv[])
 {
 	if (argc > 1)
 		return 0;
+
+	srand(getpid());
+
 	if (test_accept_timeout(0, 200000000)) {
 		fprintf(stderr, "accept timeout 0 failed\n");
 		return 1;
-- 
2.30.2


  parent reply	other threads:[~2021-09-27 13:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27  4:37 [PATCH liburing 0/2] Fix endianess issue and add srand() Ammar Faizi
2021-09-27  4:37 ` [PATCH liburing 1/2] test: Fix endianess issue on `bind()` and `connect()` Ammar Faizi
2021-09-27  4:37 ` [PATCH liburing 2/2] test/accept-link: Add `srand()` for better randomness Ammar Faizi
2021-09-27 13:28   ` Jens Axboe
2021-09-27 13:40     ` [PATCH liburing v2 0/2] Fix endianess issue and add srand() Ammar Faizi
2021-09-27 13:40       ` [PATCH liburing v2 1/2] test: Fix endianess issue on `bind()` and `connect()` Ammar Faizi
2021-09-27 13:40       ` Ammar Faizi [this message]
2021-09-27 13:45       ` [PATCH liburing v2 0/2] Fix endianess issue and add srand() Jens Axboe

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=20210927134023.294466-3-ammarfaizi2@gmail.com \
    --to=ammarfaizi2@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).