qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Thomas Huth <thuth@redhat.com>,
	qemu-devel@nongnu.org, Laurent Vivier <lvivier@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH] tests/qtest/virtio-net-failover: Use g_random_int() instead of g_test_rand_int()
Date: Mon, 20 Dec 2021 11:26:54 -0800	[thread overview]
Message-ID: <a752f53a-f563-4d54-affa-40925f39b62f@linaro.org> (raw)
In-Reply-To: <20211220102759.311224-1-thuth@redhat.com>

On 12/20/21 2:27 AM, Thomas Huth wrote:
>       const gchar *tmpdir = g_get_tmp_dir();
>       gchar *tmpfile = g_strdup_printf("%s/failover_test_migrate-%u-%u",
> -                                     tmpdir, getpid(), g_test_rand_int());
> +                                     tmpdir, getpid(), g_random_int());

Random numbers plus pid are irrelevant, because you still don't have guaranteed uniqueness 
-- think stale files in /tmp.

Use g_file_open_tmp.


r~


  parent reply	other threads:[~2021-12-20 19:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 10:27 [PATCH] tests/qtest/virtio-net-failover: Use g_random_int() instead of g_test_rand_int() Thomas Huth
2021-12-20 11:54 ` Laurent Vivier
2021-12-20 13:16 ` Philippe Mathieu-Daudé
2021-12-20 19:26 ` Richard Henderson [this message]
2021-12-20 20:02   ` Philippe Mathieu-Daudé
2021-12-21 10:32     ` Thomas Huth
2021-12-21 19:32       ` Richard Henderson
2021-12-22  7:02         ` Thomas Huth

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=a752f53a-f563-4d54-affa-40925f39b62f@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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).