]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Fix compilation with GCC-8
authorBreno Leitao <leitao@debian.org>
Mon, 21 Jan 2019 11:31:15 +0000 (06:31 -0500)
committerBreno Leitao <leitao@debian.org>
Mon, 21 Jan 2019 11:31:15 +0000 (06:31 -0500)
Printf() is being called to print an unsigned long int using the long long
identifier. This causes the following error with GCC-8:

nvme.c:3056:5: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘__u64 {aka long unsigned int}’ [-Werror=format=]
     "Invalid value for block size (%llu), must be a power of two\n",
     ^
nvme.c:3091:6: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘__u64 {aka long unsigned int}’ [-Werror=format=]
      "LBAF corresponding to block size %llu (LBAF %u) not found\n",

Adjusting the printf arguments to print the proper format.

Signed-off-by: Breno Leitao <leitao@debian.org>
nvme.c

diff --git a/nvme.c b/nvme.c
index 992c6b9737c0606ce055a886eef8f6b95b091ad9..e85834db1293666f7ce98b848687d27481621924 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -3053,7 +3053,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
        if (cfg.bs) {
                if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) {
                        fprintf(stderr,
-                               "Invalid value for block size (%llu), must be a power of two\n",
+                               "Invalid value for block size (%lu), must be a power of two\n",
                                        cfg.bs);
                                return EINVAL;
                }
@@ -3088,7 +3088,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu
                        }
                        if (cfg.lbaf == 0xff) {
                                fprintf(stderr,
-                                       "LBAF corresponding to block size %llu (LBAF %u) not found\n",
+                                       "LBAF corresponding to block size %lu (LBAF %u) not found\n",
                                        cfg.bs, lbads);
                                fprintf(stderr,
                                        "Please correct block size, or specify LBAF directly\n");