All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] main-loop: Fix SetEvent() on uninitialized handle on win32
Date: Wed, 01 Feb 2012 16:10:14 -0600	[thread overview]
Message-ID: <4F29B846.3020201@redhat.com> (raw)
In-Reply-To: <1327108107-16600-1-git-send-email-mdroth@linux.vnet.ibm.com>

On 01/20/2012 07:08 PM, Michael Roth wrote:
> The __attribute__((constructor)) init_main_loop() automatically get
> called if qemu-tool.o is linked in. On win32, this leads to
> a qemu_notify_event() call which attempts to SetEvent() on a HANDLE that
> won't be initialized until qemu_init_main_loop() is manually called,
> breaking qemu-tools.o programs on Windows at runtime.
>
> This patch checks for an initialized event handle before attempting to
> set it, which is analoguous to how we deal with an unitialized
> io_thread_fd in the posix implementation.
>
> Signed-off-by: Michael Roth<mdroth@linux.vnet.ibm.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   main-loop.c |    5 ++++-
>   1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/main-loop.c b/main-loop.c
> index 692381c..62d95b9 100644
> --- a/main-loop.c
> +++ b/main-loop.c
> @@ -164,7 +164,7 @@ static int qemu_signal_init(void)
>
>   #else /* _WIN32 */
>
> -HANDLE qemu_event_handle;
> +HANDLE qemu_event_handle = NULL;
>
>   static void dummy_event_handler(void *opaque)
>   {
> @@ -183,6 +183,9 @@ static int qemu_event_init(void)
>
>   void qemu_notify_event(void)
>   {
> +    if (!qemu_event_handle) {
> +        return;
> +    }
>       if (!SetEvent(qemu_event_handle)) {
>           fprintf(stderr, "qemu_notify_event: SetEvent failed: %ld\n",
>                   GetLastError());



WARNING: multiple messages have this Message-ID (diff)
From: Anthony Liguori <anthony@codemonkey.ws>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] main-loop: Fix SetEvent() on uninitialized handle on win32
Date: Wed, 01 Feb 2012 16:10:14 -0600	[thread overview]
Message-ID: <4F29B846.3020201@redhat.com> (raw)
In-Reply-To: <1327108107-16600-1-git-send-email-mdroth@linux.vnet.ibm.com>

On 01/20/2012 07:08 PM, Michael Roth wrote:
> The __attribute__((constructor)) init_main_loop() automatically get
> called if qemu-tool.o is linked in. On win32, this leads to
> a qemu_notify_event() call which attempts to SetEvent() on a HANDLE that
> won't be initialized until qemu_init_main_loop() is manually called,
> breaking qemu-tools.o programs on Windows at runtime.
>
> This patch checks for an initialized event handle before attempting to
> set it, which is analoguous to how we deal with an unitialized
> io_thread_fd in the posix implementation.
>
> Signed-off-by: Michael Roth<mdroth@linux.vnet.ibm.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   main-loop.c |    5 ++++-
>   1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/main-loop.c b/main-loop.c
> index 692381c..62d95b9 100644
> --- a/main-loop.c
> +++ b/main-loop.c
> @@ -164,7 +164,7 @@ static int qemu_signal_init(void)
>
>   #else /* _WIN32 */
>
> -HANDLE qemu_event_handle;
> +HANDLE qemu_event_handle = NULL;
>
>   static void dummy_event_handler(void *opaque)
>   {
> @@ -183,6 +183,9 @@ static int qemu_event_init(void)
>
>   void qemu_notify_event(void)
>   {
> +    if (!qemu_event_handle) {
> +        return;
> +    }
>       if (!SetEvent(qemu_event_handle)) {
>           fprintf(stderr, "qemu_notify_event: SetEvent failed: %ld\n",
>                   GetLastError());

  parent reply	other threads:[~2012-02-01 22:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-21  1:08 [Qemu-trivial] [PATCH] main-loop: Fix SetEvent() on uninitialized handle on win32 Michael Roth
2012-01-21  1:08 ` [Qemu-devel] " Michael Roth
2012-01-21  7:49 ` Paolo Bonzini
2012-01-21 17:13 ` [Qemu-trivial] [PATCH] main-loop: For tools, initialize timers as part of qemu_init_main_loop() Michael Roth
2012-01-21 17:13   ` [Qemu-devel] " Michael Roth
2012-01-21 20:39   ` [Qemu-trivial] " Jamie Lokier
2012-01-21 20:39     ` Jamie Lokier
2012-01-22 12:32     ` Paolo Bonzini
2012-01-23  0:12       ` Michael Roth
2012-01-23  7:49         ` Paolo Bonzini
2012-01-27  5:46   ` [Qemu-trivial] " Stefan Hajnoczi
2012-01-27  5:46     ` [Qemu-devel] " Stefan Hajnoczi
2012-01-27  8:09     ` Paolo Bonzini
2012-01-27  8:09       ` [Qemu-devel] " Paolo Bonzini
2012-01-27  5:46   ` Stefan Hajnoczi
2012-01-27  5:46     ` [Qemu-devel] " Stefan Hajnoczi
2012-02-01 22:10   ` [Qemu-trivial] [Qemu-devel] " Anthony Liguori
2012-02-01 22:10     ` Anthony Liguori
2012-01-27  5:41 ` [Qemu-trivial] [PATCH] main-loop: Fix SetEvent() on uninitialized handle on win32 Stefan Hajnoczi
2012-01-27  5:41   ` [Qemu-devel] " Stefan Hajnoczi
2012-01-27 14:52   ` [Qemu-trivial] [PATCH v2] " Michael Roth
2012-01-27 14:52     ` [Qemu-devel] " Michael Roth
2012-02-01 22:10 ` Anthony Liguori [this message]
2012-02-01 22:10   ` [Qemu-devel] [PATCH] " Anthony Liguori

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=4F29B846.3020201@redhat.com \
    --to=anthony@codemonkey.ws \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.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 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.