From patchwork Thu Dec 31 01:34:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 41955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5181D1007D1 for ; Thu, 31 Dec 2009 12:49:59 +1100 (EST) Received: from localhost ([127.0.0.1]:48792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQAAm-0003CJ-Ar for incoming@patchwork.ozlabs.org; Wed, 30 Dec 2009 20:49:56 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQ9w1-0006PB-Dv for qemu-devel@nongnu.org; Wed, 30 Dec 2009 20:34:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQ9vw-0006LA-Im for qemu-devel@nongnu.org; Wed, 30 Dec 2009 20:34:40 -0500 Received: from [199.232.76.173] (port=40632 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQ9vw-0006Kv-8E for qemu-devel@nongnu.org; Wed, 30 Dec 2009 20:34:36 -0500 Received: from mail-fx0-f222.google.com ([209.85.220.222]:33611) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NQ9vv-00038j-Sl for qemu-devel@nongnu.org; Wed, 30 Dec 2009 20:34:36 -0500 Received: by fxm22 with SMTP id 22so15607708fxm.2 for ; Wed, 30 Dec 2009 17:34:34 -0800 (PST) Received: by 10.223.164.96 with SMTP id d32mr25142631fay.106.1262223274346; Wed, 30 Dec 2009 17:34:34 -0800 (PST) Received: from localhost.localdomain (a88-114-220-92.elisa-laajakaista.fi [88.114.220.92]) by mx.google.com with ESMTPS id z10sm20643205fka.30.2009.12.30.17.34.32 (version=SSLv3 cipher=RC4-MD5); Wed, 30 Dec 2009 17:34:33 -0800 (PST) From: "Kirill A. Shutemov" To: qemu-devel@nongnu.org Date: Thu, 31 Dec 2009 03:34:22 +0200 Message-Id: <1262223266-19191-1-git-send-email-kirill@shutemov.name> X-Mailer: git-send-email 1.6.5.7 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: "Kirill A. Shutemov" Subject: [Qemu-devel] [PATCH 10/14] vl.c: fix warning with _FORTIFY_SOURCE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org CC i386-softmmu/vl.o cc1: warnings being treated as errors /usr/src/RPM/BUILD/qemu-0.11.92/vl.c: In function 'qemu_event_increment': /usr/src/RPM/BUILD/qemu-0.11.92/vl.c:3404: error: ignoring return value of 'write', declared with attribute warn_unused_result /usr/src/RPM/BUILD/qemu-0.11.92/vl.c: In function 'main': /usr/src/RPM/BUILD/qemu-0.11.92/vl.c:5774: error: ignoring return value of 'write', declared with attribute warn_unused_result /usr/src/RPM/BUILD/qemu-0.11.92/vl.c:6064: error: ignoring return value of 'chdir', declared with attribute warn_unused_result /usr/src/RPM/BUILD/qemu-0.11.92/vl.c:6083: error: ignoring return value of 'chdir', declared with attribute warn_unused_result make[1]: *** [vl.o] Error 1 Signed-off-by: Kirill A. Shutemov --- vl.c | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/vl.c b/vl.c index e881e45..4527427 100644 --- a/vl.c +++ b/vl.c @@ -3390,11 +3390,17 @@ static int io_thread_fd = -1; static void qemu_event_increment(void) { static const char byte = 0; + int ret; if (io_thread_fd == -1) return; - write(io_thread_fd, &byte, sizeof(byte)); + ret = write(io_thread_fd, &byte, sizeof(byte)); + if (ret < 0 && (errno != EINTR && errno != EAGAIN)) { + fprintf(stderr, "qemu_event_increment: write() filed: %s\n", + strerror(errno)); + exit (1); + } } static void qemu_event_read(void *opaque) @@ -5778,7 +5784,10 @@ int main(int argc, char **argv, char **envp) #ifndef _WIN32 if (daemonize) { uint8_t status = 1; - write(fds[1], &status, 1); + if (write(fds[1], &status, 1) != 1) { + perror("write()"); + exit(1); + } } else #endif fprintf(stderr, "Could not acquire pid file: %s\n", strerror(errno)); @@ -6075,7 +6084,10 @@ int main(int argc, char **argv, char **envp) if (len != 1) exit(1); - chdir("/"); + if (chdir("/")) { + perror("chdir()"); + exit(1); + } TFR(fd = qemu_open("/dev/null", O_RDWR)); if (fd == -1) exit(1); @@ -6094,7 +6106,10 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "chroot failed\n"); exit(1); } - chdir("/"); + if (chdir("/")) { + perror("chdir()"); + exit(1); + } } if (run_as) {