Message ID | 20220504113158.1051861-1-arne@rfc2549.org |
---|---|
State | Accepted |
Headers | show |
Series | [Openvpn-devel] Fix format specifier for printing size_t on 32bit size_t platforms | expand |
Acked-by: Gert Doering <gert@greenie.muc.de> %zu is now a first class citizen even in MSVC, so we're safe to use it. Says Lev, and The Internet. https://stackoverflow.com/questions/15610053/correct-printf-format-specifier-for-size-t-zu-or-iu Only minimally tested ("does it compile on amd64 linux with no warning"). Your patch has been applied to the master branch. commit 6e375353ed99b794994b809570b217e3e732a44b Author: Arne Schwabe Date: Wed May 4 13:31:58 2022 +0200 Fix format specifier for printing size_t on 32bit size_t platforms Signed-off-by: Arne Schwabe <arne@rfc2549.org> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20220504113158.1051861-1-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24277.html Signed-off-by: Gert Doering <gert@greenie.muc.de> -- kind regards, Gert Doering
diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 3085e97b..e7d39645 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2431,7 +2431,7 @@ get_frame_mtu(struct context *c, const struct options *o) if (mtu < TUN_MTU_MIN) { - msg(M_WARN, "TUN MTU value (%lu) must be at least %d", mtu, TUN_MTU_MIN); + msg(M_WARN, "TUN MTU value (%zu) must be at least %d", mtu, TUN_MTU_MIN); frame_print(&c->c2.frame, M_FATAL, "MTU is too small"); } return mtu;
Today even 32 bit platform generally use a 64bit size_t but Android armeabi-v7a is an expection to that and uses a 32bit size_t. Use z as correct specifier for a size_t. Clang complained about this: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat] Signed-off-by: Arne Schwabe <arne@rfc2549.org> --- src/openvpn/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)