From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4ZS1-0007wp-CU for qemu-devel@nongnu.org; Fri, 16 Sep 2011 10:31:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4ZRx-0006RA-BU for qemu-devel@nongnu.org; Fri, 16 Sep 2011 10:31:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4ZRx-0006Qq-4X for qemu-devel@nongnu.org; Fri, 16 Sep 2011 10:31:29 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8GEVRt7013956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Sep 2011 10:31:27 -0400 Message-ID: <4E735DBE.1010202@redhat.com> Date: Fri, 16 Sep 2011 08:31:26 -0600 From: Eric Blake MIME-Version: 1.0 References: 1316107350-31172-1-git-send-email-lersek@redhat.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC] main loop: fix some accesses made in sighandler context List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: lersek@redhat.com, QEMU Developers > +++ 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