From patchwork Sun Jul 8 12:23:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 169643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 773AF2C0079 for ; Sun, 8 Jul 2012 22:42:31 +1000 (EST) Received: from localhost ([::1]:52441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SnqWm-00047N-9L for incoming@patchwork.ozlabs.org; Sun, 08 Jul 2012 08:23:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SnqVp-0001Qz-SE for qemu-devel@nongnu.org; Sun, 08 Jul 2012 08:22:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SnqVn-0001Zr-Pi for qemu-devel@nongnu.org; Sun, 08 Jul 2012 08:22:53 -0400 Received: from mail-ey0-f173.google.com ([209.85.215.173]:64889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SnqVn-0001Yv-1W for qemu-devel@nongnu.org; Sun, 08 Jul 2012 08:22:51 -0400 Received: by mail-ey0-f173.google.com with SMTP id k12so5414196eaa.4 for ; Sun, 08 Jul 2012 05:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references; bh=rsioZoyaMeZf44upcvDKsOLCxwf+/27OCxtEQC7lCUc=; b=kRpfFC0BF+1xdOewe5TmWcUHuERcbg41Tmn5pnIhy37fqjjF6KioF9B0UepPpab5C5 zDITXrgrWBU8k/egbECyLUtYGLNww2An7KcMJAv9sViMpfZwkK041R/ZuWWHrDj6rfdz m4F47T1JiQBmnOZfUlDMd+fSOgA1YnhIcofCbScKL3kOO1emik1oeO3EcF+PphPYwSv8 WsO0fkLP8wg06ZoGKWOBchKkzo5aRJxhJP89Cec/KiH+LJ1y+1dcO7ILxbOZfmXI+Zhh ejphmskxgQ1zLWpiSQYx3CnjBNEtG1lcV5WpedYG2iVq6zGUJu4vVOVhLeh3oZWVYtdX gcxQ== Received: by 10.14.95.196 with SMTP id p44mr8304708eef.15.1341750170080; Sun, 08 Jul 2012 05:22:50 -0700 (PDT) Received: from localhost.localdomain (blueswirl.broker.freenet6.net. [2001:5c0:1400:b::d5a3]) by mx.google.com with ESMTPS id e48sm85537894eea.12.2012.07.08.05.22.48 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 08 Jul 2012 05:22:49 -0700 (PDT) From: blauwirbel@gmail.com To: qemu-devel@nongnu.org Date: Sun, 8 Jul 2012 12:23:04 +0000 Message-Id: X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.215.173 Cc: blueswirl@gmail.com Subject: [Qemu-devel] [PATCH v2 4/5] Avoid unportable %m format X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Blue Swirl Replace %m format with explicit call to standard strerror(). Signed-off-by: Blue Swirl --- kvm-all.c | 3 ++- main-loop.c | 2 +- net/tap-linux.c | 8 +++++--- qemu-nbd.c | 3 +-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index f8e4328..d6f4819 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1219,7 +1219,8 @@ int kvm_init(void) s->vmfd = -1; s->fd = qemu_open("/dev/kvm", O_RDWR); if (s->fd == -1) { - fprintf(stderr, "Could not access KVM kernel module: %m\n"); + fprintf(stderr, "Could not access KVM kernel module: %s\n", + strerror(errno)); ret = -errno; goto err; } diff --git a/main-loop.c b/main-loop.c index eb3b6e6..472c55e 100644 --- a/main-loop.c +++ b/main-loop.c @@ -116,7 +116,7 @@ static void sigfd_handler(void *opaque) } if (len != sizeof(info)) { - printf("read from sigfd returned %zd: %m\n", len); + printf("read from sigfd returned %zd: %s\n", len, strerror(errno)); return; } diff --git a/net/tap-linux.c b/net/tap-linux.c index 41d581b..94e5b1e 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -42,7 +42,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required TFR(fd = open(PATH_NET_TUN, O_RDWR)); if (fd < 0) { - error_report("could not open %s: %m", PATH_NET_TUN); + error_report("could not open %s: %s", PATH_NET_TUN, strerror(errno)); return -1; } memset(&ifr, 0, sizeof(ifr)); @@ -74,9 +74,11 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required ret = ioctl(fd, TUNSETIFF, (void *) &ifr); if (ret != 0) { if (ifname[0] != '\0') { - error_report("could not configure %s (%s): %m", PATH_NET_TUN, ifr.ifr_name); + error_report("could not configure %s (%s): %s", PATH_NET_TUN, + ifr.ifr_name, strerror(errno)); } else { - error_report("could not configure %s: %m", PATH_NET_TUN); + error_report("could not configure %s: %s", PATH_NET_TUN, + strerror(errno)); } close(fd); return -1; diff --git a/qemu-nbd.c b/qemu-nbd.c index 5a0300e..099b5ed 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -213,8 +213,7 @@ static void *nbd_client_thread(void *arg) fd = open(device, O_RDWR); if (fd < 0) { - /* Linux-only, we can use %m in printf. */ - fprintf(stderr, "Failed to open %s: %m", device); + fprintf(stderr, "Failed to open %s: %s", device, strerror(errno)); goto out; }