diff options
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils/nfs-utils/0001-tools-locktest-Use-intmax_t-to-print-off_t.patch')
-rw-r--r-- | meta/recipes-connectivity/nfs-utils/nfs-utils/0001-tools-locktest-Use-intmax_t-to-print-off_t.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-tools-locktest-Use-intmax_t-to-print-off_t.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-tools-locktest-Use-intmax_t-to-print-off_t.patch new file mode 100644 index 0000000000..7d903e04bc --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-tools-locktest-Use-intmax_t-to-print-off_t.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From e2e9251dbeb452f5382179023d8ae18b511167a1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 25 Jul 2023 23:47:08 -0700 | ||
4 | Subject: [PATCH] tools/locktest: Use intmax_t to print off_t | ||
5 | |||
6 | off_t could be 64bit on 32bit architectures which means using %z printf | ||
7 | modifier is not enough to print it and compiler will complain about | ||
8 | format mismatch | ||
9 | |||
10 | Fixes | ||
11 | | testlk.c:84:66: error: format '%zd' expects argument of type 'signed size_t', but argument 4 has type '__off64_t' {aka 'long long int'} [-Werror=format=] | ||
12 | | 84 | printf("%s: conflicting lock by %d on (%zd;%zd)\n", | ||
13 | | | ~~^ | ||
14 | | | | | ||
15 | | | int | ||
16 | | | %lld | ||
17 | | 85 | fname, fl.l_pid, fl.l_start, fl.l_len); | ||
18 | | | ~~~~~~~~~~ | ||
19 | | | | | ||
20 | | | __off64_t {aka long long int} | ||
21 | |||
22 | Upstream-Status: Submitted [https://marc.info/?l=linux-nfs&m=169035457128067&w=2] | ||
23 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
24 | --- | ||
25 | tools/locktest/testlk.c | 5 +++-- | ||
26 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
27 | |||
28 | diff --git a/tools/locktest/testlk.c b/tools/locktest/testlk.c | ||
29 | index ea51f788..9d4c88c4 100644 | ||
30 | --- a/tools/locktest/testlk.c | ||
31 | +++ b/tools/locktest/testlk.c | ||
32 | @@ -2,6 +2,7 @@ | ||
33 | #include <config.h> | ||
34 | #endif | ||
35 | |||
36 | +#include <stdint.h> | ||
37 | #include <stdlib.h> | ||
38 | #include <stdio.h> | ||
39 | #include <unistd.h> | ||
40 | @@ -81,8 +82,8 @@ main(int argc, char **argv) | ||
41 | if (fl.l_type == F_UNLCK) { | ||
42 | printf("%s: no conflicting lock\n", fname); | ||
43 | } else { | ||
44 | - printf("%s: conflicting lock by %d on (%zd;%zd)\n", | ||
45 | - fname, fl.l_pid, fl.l_start, fl.l_len); | ||
46 | + printf("%s: conflicting lock by %d on (%jd;%jd)\n", | ||
47 | + fname, fl.l_pid, (intmax_t)fl.l_start, (intmax_t)fl.l_len); | ||
48 | } | ||
49 | return 0; | ||
50 | } | ||
51 | -- | ||
52 | 2.41.0 | ||
53 | |||