summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/nfs-utils
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2018-12-08 02:26:38 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-08 17:17:02 +0000
commit73e8104f9c07c0707964911b4882b55715104670 (patch)
tree66b90b05102fac8e9c2fd5922f801ad835f32f02 /meta/recipes-connectivity/nfs-utils
parent3c6751ee7a36dfce8a6cfe7acc77624e69d65546 (diff)
downloadpoky-73e8104f9c07c0707964911b4882b55715104670.tar.gz
nfs-utils: Fix build with clang
(From OE-Core rev: 924d6956fb5bef3effe8914fe61e8cad6f71a231) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils')
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/clang-format-string.patch183
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb2
2 files changed, 184 insertions, 1 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-format-string.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-format-string.patch
new file mode 100644
index 0000000000..1d693e4142
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-format-string.patch
@@ -0,0 +1,183 @@
1Clang comes up with more printf format warnings
2Correcting “format string is not a string literal” warning
3requires us to declare that parameter is a printf style
4format using the attribute flag
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10Index: nfs-utils-2.3.3/support/include/xcommon.h
11===================================================================
12--- nfs-utils-2.3.3.orig/support/include/xcommon.h
13+++ nfs-utils-2.3.3/support/include/xcommon.h
14@@ -27,7 +27,7 @@
15
16 /* Functions in sundries.c that are used in mount.c and umount.c */
17 char *canonicalize (const char *path);
18-void nfs_error (const char *fmt, ...);
19+void nfs_error (const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2)));
20 void *xmalloc (size_t size);
21 void *xrealloc(void *p, size_t size);
22 void xfree(void *);
23@@ -36,9 +36,9 @@ char *xstrndup (const char *s, int n);
24 char *xstrconcat2 (const char *, const char *);
25 char *xstrconcat3 (const char *, const char *, const char *);
26 char *xstrconcat4 (const char *, const char *, const char *, const char *);
27-void die (int errcode, const char *fmt, ...);
28+void die (int errcode, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
29
30-extern void die(int err, const char *fmt, ...);
31+extern void die(int err, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
32 extern void (*at_die)(void);
33
34 /* exit status - bits below are ORed */
35Index: nfs-utils-2.3.3/support/include/xlog.h
36===================================================================
37--- nfs-utils-2.3.3.orig/support/include/xlog.h
38+++ nfs-utils-2.3.3/support/include/xlog.h
39@@ -43,10 +43,10 @@ void xlog_config(int fac, int on);
40 void xlog_sconfig(char *, int on);
41 void xlog_from_conffile(char *);
42 int xlog_enabled(int fac);
43-void xlog(int fac, const char *fmt, ...);
44-void xlog_warn(const char *fmt, ...);
45-void xlog_err(const char *fmt, ...);
46-void xlog_errno(int err, const char *fmt, ...);
47-void xlog_backend(int fac, const char *fmt, va_list args);
48+void xlog(int fac, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
49+void xlog_warn(const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2)));
50+void xlog_err(const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2)));
51+void xlog_errno(int err, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
52+void xlog_backend(int fac, const char *fmt, va_list args) __attribute__((__format__ (__printf__, 2, 0)));
53
54 #endif /* XLOG_H */
55Index: nfs-utils-2.3.3/support/nfs/xcommon.c
56===================================================================
57--- nfs-utils-2.3.3.orig/support/nfs/xcommon.c
58+++ nfs-utils-2.3.3/support/nfs/xcommon.c
59@@ -93,7 +93,10 @@ nfs_error (const char *fmt, ...) {
60
61 fmt2 = xstrconcat2 (fmt, "\n");
62 va_start (args, fmt);
63+#pragma clang diagnostic push
64+#pragma clang diagnostic ignored "-Wformat-nonliteral"
65 vfprintf (stderr, fmt2, args);
66+#pragma clang diagnostic pop
67 va_end (args);
68 free (fmt2);
69 }
70Index: nfs-utils-2.3.3/utils/exportfs/exportfs.c
71===================================================================
72--- nfs-utils-2.3.3.orig/utils/exportfs/exportfs.c
73+++ nfs-utils-2.3.3/utils/exportfs/exportfs.c
74@@ -644,6 +644,7 @@ out:
75 return result;
76 }
77
78+__attribute__((__format__ (__printf__, 2, 3)))
79 static char
80 dumpopt(char c, char *fmt, ...)
81 {
82Index: nfs-utils-2.3.3/utils/statd/statd.c
83===================================================================
84--- nfs-utils-2.3.3.orig/utils/statd/statd.c
85+++ nfs-utils-2.3.3/utils/statd/statd.c
86@@ -136,7 +136,7 @@ static void log_modes(void)
87 strcat(buf, "TI-RPC ");
88 #endif
89
90- xlog_warn(buf);
91+ xlog_warn("%s", buf);
92 }
93
94 /*
95Index: nfs-utils-2.3.3/support/nfs/svc_create.c
96===================================================================
97--- nfs-utils-2.3.3.orig/support/nfs/svc_create.c
98+++ nfs-utils-2.3.3/support/nfs/svc_create.c
99@@ -184,7 +184,7 @@ svc_create_sock(const struct sockaddr *s
100 type = SOCK_STREAM;
101 break;
102 default:
103- xlog(D_GENERAL, "%s: Unrecognized bind address semantics: %u",
104+ xlog(D_GENERAL, "%s: Unrecognized bind address semantics: %lu",
105 __func__, nconf->nc_semantics);
106 return -1;
107 }
108Index: nfs-utils-2.3.3/support/nsm/rpc.c
109===================================================================
110--- nfs-utils-2.3.3.orig/support/nsm/rpc.c
111+++ nfs-utils-2.3.3/support/nsm/rpc.c
112@@ -182,7 +182,7 @@ nsm_xmit_getport(const int sock, const s
113 uint32_t xid;
114 XDR xdr;
115
116- xlog(D_CALL, "Sending PMAP_GETPORT for %u, %u, udp", program, version);
117+ xlog(D_CALL, "Sending PMAP_GETPORT for %lu, %lu, udp", program, version);
118
119 nsm_init_xdrmem(msgbuf, NSM_MAXMSGSIZE, &xdr);
120 xid = nsm_init_rpc_header(PMAPPROG, PMAPVERS,
121Index: nfs-utils-2.3.3/utils/mountd/cache.c
122===================================================================
123--- nfs-utils-2.3.3.orig/utils/mountd/cache.c
124+++ nfs-utils-2.3.3/utils/mountd/cache.c
125@@ -968,8 +968,7 @@ lookup_export(char *dom, char *path, str
126 } else if (found_type == i && found->m_warned == 0) {
127 xlog(L_WARNING, "%s exported to both %s and %s, "
128 "arbitrarily choosing options from first",
129- path, found->m_client->m_hostname, exp->m_client->m_hostname,
130- dom);
131+ path, found->m_client->m_hostname, exp->m_client->m_hostname);
132 found->m_warned = 1;
133 }
134 }
135Index: nfs-utils-2.3.3/utils/mountd/mountd.c
136===================================================================
137--- nfs-utils-2.3.3.orig/utils/mountd/mountd.c
138+++ nfs-utils-2.3.3/utils/mountd/mountd.c
139@@ -213,7 +213,7 @@ static void
140 sig_hup (int sig)
141 {
142 /* don't exit on SIGHUP */
143- xlog (L_NOTICE, "Received SIGHUP... Ignoring.\n", sig);
144+ xlog (L_NOTICE, "Received SIGHUP(%d)... Ignoring.\n", sig);
145 return;
146 }
147
148Index: nfs-utils-2.3.3/utils/statd/rmtcall.c
149===================================================================
150--- nfs-utils-2.3.3.orig/utils/statd/rmtcall.c
151+++ nfs-utils-2.3.3/utils/statd/rmtcall.c
152@@ -247,7 +247,7 @@ process_reply(FD_SET_TYPE *rfds)
153 xlog_warn("%s: service %d not registered on localhost",
154 __func__, NL_MY_PROG(lp));
155 } else {
156- xlog(D_GENERAL, "%s: Callback to %s (for %d) succeeded",
157+ xlog(D_GENERAL, "%s: Callback to %s (for %s) succeeded",
158 __func__, NL_MY_NAME(lp), NL_MON_NAME(lp));
159 }
160 nlist_free(&notify, lp);
161Index: nfs-utils-2.3.3/utils/statd/svc_run.c
162===================================================================
163--- nfs-utils-2.3.3.orig/utils/statd/svc_run.c
164+++ nfs-utils-2.3.3/utils/statd/svc_run.c
165@@ -53,6 +53,7 @@
166
167 #include <errno.h>
168 #include <time.h>
169+#include <inttypes.h>
170 #include "statd.h"
171 #include "notlist.h"
172
173@@ -104,8 +105,8 @@ my_svc_run(int sockfd)
174
175 tv.tv_sec = NL_WHEN(notify) - now;
176 tv.tv_usec = 0;
177- xlog(D_GENERAL, "Waiting for reply... (timeo %d)",
178- tv.tv_sec);
179+ xlog(D_GENERAL, "Waiting for reply... (timeo %jd)",
180+ (intmax_t)tv.tv_sec);
181 selret = select(FD_SETSIZE, &readfds,
182 (void *) 0, (void *) 0, &tv);
183 } else {
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb
index 572ae3146f..6be2aab47c 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.3.3.bb
@@ -32,8 +32,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x
32 file://nfs-utils-musl-limits.patch \ 32 file://nfs-utils-musl-limits.patch \
33 file://0001-cacheio-use-intmax_t-for-formatted-IO.patch \ 33 file://0001-cacheio-use-intmax_t-for-formatted-IO.patch \
34 file://0001-Do-not-pass-null-pointer-to-freeaddrinfo.patch \ 34 file://0001-Do-not-pass-null-pointer-to-freeaddrinfo.patch \
35 file://clang-format-string.patch \
35" 36"
36
37SRC_URI_append_libc-musl = " file://nfs-utils-musl-res_querydomain.patch" 37SRC_URI_append_libc-musl = " file://nfs-utils-musl-res_querydomain.patch"
38 38
39SRC_URI[md5sum] = "b6c9c032995af1c08fea9fbcc1ce33e9" 39SRC_URI[md5sum] = "b6c9c032995af1c08fea9fbcc1ce33e9"