]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: fix compiler warnings
authorDavidlohr Bueso <dave@gnu.org>
Wed, 4 Jan 2012 22:28:59 +0000 (23:28 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 5 Jan 2012 16:09:27 +0000 (17:09 +0100)
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

index 0a7841d1f589029fb4c223b9458cf03a85987bc7..5214a1278012a20e65966d5bf7020e62963e4f5a 100644 (file)
@@ -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;
 }