From patchwork Tue Jan 19 23:56:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 43248 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 7D19DB7CD9 for ; Wed, 20 Jan 2010 11:19:25 +1100 (EST) Received: from localhost ([127.0.0.1]:42290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXOFn-0004Rs-6s for incoming@patchwork.ozlabs.org; Tue, 19 Jan 2010 19:16:59 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXNwL-0005v6-D5 for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:53 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXNwG-0005r9-JD for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:52 -0500 Received: from [199.232.76.173] (port=59385 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXNwG-0005qx-3T for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48732) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NXNwF-0005wa-Fi for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:47 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0JNukUe030919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 19 Jan 2010 18:56:46 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0JNuT3s027975; Tue, 19 Jan 2010 18:56:45 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 20 Jan 2010 00:56:18 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: kirill@shutemov.name Subject: [Qemu-devel] [PATCH 11/17] 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 From: Kirill A. Shutemov 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 Signed-off-by: Juan Quintela --- vl.c | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/vl.c b/vl.c index 06cb40d..7c29179 100644 --- a/vl.c +++ b/vl.c @@ -3176,11 +3176,17 @@ static int io_thread_fd = -1; static void qemu_event_increment(void) { static const char byte = 0; + ssize_t 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) @@ -5585,7 +5591,9 @@ 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("daemonize. Writing to pipe\n"); + } } else #endif fprintf(stderr, "Could not acquire pid file: %s\n", strerror(errno)); @@ -5884,7 +5892,10 @@ int main(int argc, char **argv, char **envp) if (len != 1) exit(1); - chdir("/"); + if (chdir("/")) { + perror("not able to chdir to /"); + exit(1); + } TFR(fd = qemu_open("/dev/null", O_RDWR)); if (fd == -1) exit(1); @@ -5903,7 +5914,10 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "chroot failed\n"); exit(1); } - chdir("/"); + if (chdir("/")) { + perror("not able to chdir to /"); + exit(1); + } } if (run_as) {