From: Eric Blake <eblake@redhat.com>
To: lersek@redhat.com, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH RFC] main loop: fix some accesses made in sighandler context
Date: Fri, 16 Sep 2011 08:31:26 -0600 [thread overview]
Message-ID: <4E735DBE.1010202@redhat.com> (raw)
> +++ b/cpus.c
> @@ -289,9 +289,16 @@ static void qemu_event_increment(void)
>
> /* EAGAIN is fine, a read must be pending. */
> if (ret < 0 && errno != EAGAIN) {
> - fprintf(stderr, "qemu_event_increment: write() failed: %s\n",
> - strerror(errno));
> - exit (1);
> + int len;
> + char buf[128];
> +
> + /* Don't bother with strerror_[rl]. Make a single attempt to write. */
> + len = snprintf(buf, sizeof buf,
> + "qemu_event_increment: write() failed: %d\n", errno);
snprintf is not async-signal safe (it can malloc, and depending on the
implementation, tries to grab stdio locks, neither of which is safe).
--
Eric Blake eblake@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
next reply other threads:[~2011-09-16 14:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-16 14:31 Eric Blake [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-09-15 17:22 [Qemu-devel] [PATCH RFC] main loop: fix some accesses made in sighandler context Laszlo Ersek
2011-09-15 19:16 ` Anthony Liguori
2011-09-16 8:08 ` Laszlo Ersek
2011-09-15 19:44 ` Peter Maydell
2011-09-16 7:58 ` Laszlo Ersek
2011-09-16 9:09 ` Markus Armbruster
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=4E735DBE.1010202@redhat.com \
--to=eblake@redhat.com \
--cc=lersek@redhat.com \
--cc=qemu-devel@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.