|
| From: | Eric Blake |
| Subject: | Re: [Qemu-devel] [PATCH RFC] main loop: fix some accesses made in sighandler context |
| Date: | Fri, 16 Sep 2011 08:31:26 -0600 |
| User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.20) Gecko/20110831 Fedora/3.1.12-2.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.12 |
+++ 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 address@hidden +1-801-349-2682 Libvirt virtualization library http://libvirt.org
| [Prev in Thread] | Current Thread | [Next in Thread] |