From: Davidlohr Bueso Date: Wed, 4 Jan 2012 22:28:59 +0000 (+0100) Subject: lscpu: fix compiler warnings X-Git-Tag: v2.21-rc1~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=756d79cd63d78650fa03662c3dfe5b8bd3eaa393;p=thirdparty%2Futil-linux.git lscpu: fix compiler warnings 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 --- diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 0a7841d1f5..5214a12780 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; }