util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: [PATCH] lscpu: fix compiler warnings
Date: Wed, 04 Jan 2012 23:28:59 +0100	[thread overview]
Message-ID: <1325716139.7056.1.camel@offbook> (raw)

From: Davidlohr Bueso <dave@gnu.org>

The string format is not being passed triggering:

    lscpu.c: In function ‘read_hypervisor’:
    lscpu.c:545:4: warning: format not a string literal and no format arguments
    lscpu.c: In function ‘get_cell_header’:
    lscpu.c:904:2: warning: format not a string literal and no format arguments
    lscpu.c:904:2: warning: format not a string literal and no format arguments

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 sys-utils/lscpu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 0a7841d..5214a12 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -542,7 +542,7 @@ read_hypervisor(struct lscpu_desc *desc)
 			str = strchr(buf, ':');
 			if (!str)
 				continue;
-			if (asprintf(&str, str + 1) == -1)
+			if (asprintf(&str, "%s", str + 1) == -1)
 				errx(EXIT_FAILURE, _("failed to allocate memory"));
 			/* remove leading, trailing and repeating whitespace */
 			while (*str == ' ')
@@ -901,7 +901,7 @@ get_cell_header(struct lscpu_desc *desc, int col,
 		if (desc->ncaches)
 			return buf;
 	}
-	snprintf(buf, bufsz, coldescs[col].name);
+	snprintf(buf, bufsz, "%s", coldescs[col].name);
 	return buf;
 }
 
-- 
1.7.4.1




         reply	other threads:[~2012-01-04 22:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 23:02 [PATCH 2/2] sfdisk: use is_blkdev Davidlohr Bueso
2012-01-04 23:02 ` [PATCH 1/2] blkdev: add is_blkdev function Davidlohr Bueso
2012-01-04 22:28   ` Davidlohr Bueso [this message]
     [not found]     ` <1324994959-24298-1-git-send-email-gaowanlong@cn.fujitsu.com>
2011-12-20 13:42       ` [PATCH 4/5] fdisk: remove packed definitions Davidlohr Bueso
2011-12-20 13:42         ` [PATCH 3/5] sfdisk: do not depend on arch for packed attribute Davidlohr Bueso
2012-01-05 16:29           ` Karel Zak
2011-12-22  2:33         ` [PATCH 4/5] fdisk: remove packed definitions Guillem Jover
2012-01-05 16:30     ` [PATCH] lscpu: fix compiler warnings Karel Zak
2012-01-05 16:31   ` [PATCH 1/2] blkdev: add is_blkdev function Karel Zak
2012-01-05 16:31 ` [PATCH 2/2] sfdisk: use is_blkdev Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325716139.7056.1.camel@offbook \
    --to=dave@gnu.org \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).