diff options
author | Jeremy Sowden <jeremy@azazel.net> | 2021-11-30 10:55:55 +0000 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2022-01-03 17:42:43 +0100 |
commit | 9a0487a2b4d8877392d872542a5ada489e454b90 (patch) | |
tree | f017e863ced8b0d0905bb3eb4c9fc2915df042f6 /libipulog | |
parent | 5cb343adf5c9afa7c72814b8dfb46dc5bc3820d8 (diff) |
output: JSON: fix output of GMT offset
The compiler has two sets of complaints. Firstly, `t->tm_gmtoffset` is
a `long int`, but it is being passed to `abs`, which leads to warnings
such as:
ulogd_output_JSON.c:308:34: warning: absolute value function `abs` given an argument of type `long int` but has parameter of type `int` which may cause truncation of value
Secondly, it can't verify that the hour value derived from the offset
will in fact fit into `%02d`, thus:
ulogd_output_JSON.c:306:37: warning: `%02d` directive output may be truncated writing between 2 and 6 bytes into a region of size 5
To remedy these, we now mod the offset by 86,400 and assign it to an `int`
before deriving the hour and minute values.
We also change the format-specifier for the hour value to `%+03d` which
causes a sign to be printed even if the value is positive, thus allowing
us not to specify the sign explicitly and to drop the `abs` call for the
hour value.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'libipulog')
0 files changed, 0 insertions, 0 deletions