]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
devlink: fix format string warning for 32bit targets
authorBaruch Siach <baruch@tkos.co.il>
Thu, 27 Jun 2019 18:37:18 +0000 (21:37 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 28 Jun 2019 22:20:00 +0000 (15:20 -0700)
32bit targets define uint64_t as long long unsigned. This leads to the
following build warning:

devlink.c: In function ‘pr_out_u64’:
devlink.c:1729:11: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t {aka long long unsigned int}’ [-Wformat=]
    pr_out("%s %lu", name, val);
           ^
devlink.c:59:21: note: in definition of macro ‘pr_out’
   fprintf(stdout, ##args);   \
                     ^~~~

Use uint64_t specific conversion specifiers in the format string to fix
that.

Cc: Aya Levin <ayal@mellanox.com>
Cc: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
devlink/devlink.c

index 4e277f7b0bc3b623fbb50b4b5821c8b3b95bbb69..97b93730e6d6177f64ffd0f6c0ce4f62a1921a9d 100644 (file)
@@ -1748,9 +1748,9 @@ static void pr_out_u64(struct dl *dl, const char *name, uint64_t val)
                jsonw_u64_field(dl->jw, name, val);
        } else {
                if (g_indent_newline)
-                       pr_out("%s %lu", name, val);
+                       pr_out("%s %"PRIu64, name, val);
                else
-                       pr_out(" %s %lu", name, val);
+                       pr_out(" %s %"PRIu64, name, val);
        }
 }
 
@@ -1775,7 +1775,7 @@ static void pr_out_uint64_value(struct dl *dl, uint64_t value)
        if (dl->json_output)
                jsonw_u64(dl->jw, value);
        else
-               pr_out(" %lu", value);
+               pr_out(" %"PRIu64, value);
 }
 
 static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len)