+++ 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   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Reply via email to