qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>,
	Thomas Huth <thuth@redhat.com>,
	qemu-devel@nongnu.org, Laurent Vivier <lvivier@redhat.com>
Cc: Paolo Bonzini <pbonzini@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 21:02:22 +0100	[thread overview]
Message-ID: <72a60ec5-156b-d73e-9150-91c79eb92fc7@redhat.com> (raw)
In-Reply-To: <a752f53a-f563-4d54-affa-40925f39b62f@linaro.org>

On 12/20/21 20:26, Richard Henderson wrote:
> 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.

Another use in test_socket_unix_abstract(),
tests/unit/test-util-sockets.c.



  reply	other threads:[~2021-12-20 20:17 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
2021-12-20 20:02   ` Philippe Mathieu-Daudé [this message]
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=72a60ec5-156b-d73e-9150-91c79eb92fc7@redhat.com \
    --to=philmd@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).