All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Yonggang Luo <luoyonggang@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Ed Maste <emaste@freebsd.org>,
	qemu-block@nongnu.org, Stefan Weil <sw@weilnetz.de>,
	Xie Changlong <xiechanglong.d@gmail.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Wen Congyang <wencongyang2@huawei.com>,
	Max Reitz <mreitz@redhat.com>, Li-Wen Hsu <lwhsu@freebsd.org>,
	Markus Armbruster <armbru@redhat.com>, Peter Lieven <pl@kamp.de>
Subject: Re: [PATCH 07/16] tests: Trying fixes test-replication.c on msys2/mingw.
Date: Wed, 9 Sep 2020 09:23:58 +0100	[thread overview]
Message-ID: <20200909082358.GG1011023@redhat.com> (raw)
In-Reply-To: <20200908194820.702-8-luoyonggang@gmail.com>

On Wed, Sep 09, 2020 at 03:48:11AM +0800, Yonggang Luo wrote:
> On Windows there is no path like /tmp/s_local_disk.XXXXXX
> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  tests/test-replication.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/test-replication.c b/tests/test-replication.c
> index 9ab3666a90..cfc1ae6feb 100644
> --- a/tests/test-replication.c
> +++ b/tests/test-replication.c
> @@ -23,14 +23,14 @@
>  
>  /* primary */
>  #define P_ID "primary-id"
> -static char p_local_disk[] = "/tmp/p_local_disk.XXXXXX";
> +static char p_local_disk[PATH_MAX];
>  
>  /* secondary */
>  #define S_ID "secondary-id"
>  #define S_LOCAL_DISK_ID "secondary-local-disk-id"
> -static char s_local_disk[] = "/tmp/s_local_disk.XXXXXX";
> -static char s_active_disk[] = "/tmp/s_active_disk.XXXXXX";
> -static char s_hidden_disk[] = "/tmp/s_hidden_disk.XXXXXX";
> +static char s_local_disk[PATH_MAX];
> +static char s_active_disk[PATH_MAX];
> +static char s_hidden_disk[PATH_MAX];
>  
>  /* FIXME: steal from blockdev.c */
>  QemuOptsList qemu_drive_opts = {
> @@ -571,6 +571,11 @@ static void setup_sigabrt_handler(void)
>  int main(int argc, char **argv)
>  {
>      int ret;
> +    const char *tmpdir = g_get_tmp_dir();
> +    snprintf(p_local_disk, sizeof(p_local_disk), "%s/p_local_disk.XXXXXX", tmpdir);
> +    snprintf(s_local_disk, sizeof(s_local_disk), "%s/s_local_disk.XXXXXX", tmpdir);
> +    snprintf(s_active_disk, sizeof(s_active_disk), "%s/s_active_disk.XXXXXX", tmpdir);
> +    snprintf(s_hidden_disk, sizeof(s_hidden_disk), "%s/s_hidden_disk.XXXXXX", tmpdir);

Don't use PATH_MAX and snprintf.  Please use g_strdup_printf() as suggested
already in previous reviews.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2020-09-09  8:25 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 19:48 [PATCH 00/16] W32, W64 patches Yonggang Luo
2020-09-08 19:48 ` [PATCH 01/16] block: Fixes nfs compiling error on msys2/mingw Yonggang Luo
2020-09-08 19:48 ` [PATCH 02/16] ci: fixes msys2 build by upgrading capstone to 4.0.2 Yonggang Luo
2020-09-08 20:36   ` Peter Maydell
2020-09-08 20:57     ` 罗勇刚(Yonggang Luo)
2020-09-08 19:48 ` [PATCH 03/16] configure: Fixes ncursesw detection under msys2/mingw and enable curses Yonggang Luo
2020-09-09  4:56   ` Gerd Hoffmann
2020-09-08 19:48 ` [PATCH 04/16] curses: Fixes curses compiling errors Yonggang Luo
2020-09-09  4:56   ` Gerd Hoffmann
2020-09-08 19:48 ` [PATCH 05/16] tests: disable /char/stdio/* tests in test-char.c on win32 Yonggang Luo
2020-09-09  7:13   ` Thomas Huth
2020-09-09  7:52     ` 罗勇刚(Yonggang Luo)
2020-09-08 19:48 ` [PATCH 06/16] ci: Enable msys2 ci in cirrus Yonggang Luo
2020-09-09  8:27   ` Daniel P. Berrangé
2020-09-09  9:36     ` 罗勇刚(Yonggang Luo)
2020-09-09  9:40       ` Daniel P. Berrangé
2020-09-08 19:48 ` [PATCH 07/16] tests: Trying fixes test-replication.c on msys2/mingw Yonggang Luo
2020-09-09  8:23   ` Daniel P. Berrangé [this message]
2020-09-08 19:48 ` [PATCH 08/16] block: get file-win32.c handle locking option consistence with file-posix.c Yonggang Luo
2020-09-09  8:19   ` Kevin Wolf
2020-09-09  8:41     ` 罗勇刚(Yonggang Luo)
2020-09-09  8:57       ` Kevin Wolf
2020-09-08 19:48 ` [PATCH 09/16] osdep: These function are only available on Non-Win32 system Yonggang Luo
2020-09-08 19:48 ` [PATCH 10/16] meson: Use -b to ignore CR vs. CR-LF issues on Windows Yonggang Luo
2020-09-08 19:48 ` [PATCH 11/16] meson: disable crypto tests are empty under win32 Yonggang Luo
2020-09-09  8:07   ` Thomas Huth
2020-09-09  8:10   ` Daniel P. Berrangé
2020-09-09  8:17     ` 罗勇刚(Yonggang Luo)
2020-09-09  8:22       ` Daniel P. Berrangé
2020-09-09  8:30         ` 罗勇刚(Yonggang Luo)
2020-09-09  8:39           ` Daniel P. Berrangé
2020-09-08 19:48 ` [PATCH 12/16] meson: remove empty else and duplicated gio deps Yonggang Luo
2020-09-08 19:48 ` [PATCH 13/16] vmstate: Fixes test-vmstate.c on msys2/mingw Yonggang Luo
2020-09-09  8:11   ` Thomas Huth
2020-09-08 19:48 ` [PATCH 14/16] cirrus: Building freebsd in a single short Yonggang Luo
2020-09-09  8:15   ` Thomas Huth
2020-09-09  8:17   ` Daniel P. Berrangé
2020-09-09  8:24     ` 罗勇刚(Yonggang Luo)
2020-09-09  8:42       ` Daniel P. Berrangé
2020-09-08 19:48 ` [PATCH 15/16] logging: Fixes memory leak in test-logging.c Yonggang Luo
2020-09-08 19:48 ` [PATCH 16/16] rcu: add uninit destructor for rcu Yonggang Luo
2020-09-08 20:41 ` [PATCH 00/16] W32, W64 patches Eric Blake
2020-09-08 20:52   ` 罗勇刚(Yonggang Luo)

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=20200909082358.GG1011023@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=emaste@freebsd.org \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=luoyonggang@gmail.com \
    --cc=lwhsu@freebsd.org \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mreitz@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sw@weilnetz.de \
    --cc=wencongyang2@huawei.com \
    --cc=xiechanglong.d@gmail.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 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.