diff options
author | Selva Nair | 2018-02-21 23:54:55 -0500 |
---|---|---|
committer | Gert Doering | 2018-02-22 16:26:25 +0100 |
commit | 06ad53e067d9a8be571a27f44005fa7e8038f69e (patch) | |
tree | befc960d260aeb596c8dc68b0660c9ea6ccf22c1 /src/openvpn/misc.c | |
parent | 7bba4007824cc7fe7ba487210222b546de9269f0 (diff) | |
download | openvpn-06ad53e067d9a8be571a27f44005fa7e8038f69e.zip openvpn-06ad53e067d9a8be571a27f44005fa7e8038f69e.tar.gz |
Fix format spec errors in Windows builds
- "%ll" is not supported by Windows run time, so use PRIi64
and cast the variable to (int64_t) in output statements
(as in commit 9ba36639abcac4367c8227d2dd87b18fb56267c4)
- Fix an instance of wchar_t * printed using %s -- should be %ls.
- Cast variables to int or unsigned int to match the output
format spec when necessary.
- In route.c correct format of adapter_index (should be %lu) in a few
places and remove some unnecessary casts to (unsigned int). Not
all such instances are changed, only those related to adapter_index
(for consistency) or close-by contexts are edited.
Most of these errors are seen in current Windows cross-compile,
but a few are triggered only if some DEBUG options are enabled.
Some are not in Windows specific paths. But for consistency, all uses
of %llu/%lld are removed. As these only affect log output, there are
no potential side effects.
Replacing long long by int64_t also has the advantage of avoiding
size ambiguity as long long is not guaranteed to be 64 bytes.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1519275295-29121-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16522.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/misc.c')
-rw-r--r-- | src/openvpn/misc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c index 23e272c..72ffc40 100644 --- a/src/openvpn/misc.c +++ b/src/openvpn/misc.c @@ -556,7 +556,7 @@ void setenv_long_long(struct env_set *es, const char *name, long long value) { char buf[64]; - openvpn_snprintf(buf, sizeof(buf), "%lld", value); + openvpn_snprintf(buf, sizeof(buf), "%"PRIi64, (int64_t)value); setenv_str(es, name, buf); } |