[ulogd2 PATCH v2 23/27] output: JSON: fix output of GMT offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



`gmt_offset` is a `long int`.  Use `labs` and update the format-specifier
to match.

Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx>
---
 output/ulogd_output_JSON.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/output/ulogd_output_JSON.c b/output/ulogd_output_JSON.c
index 6edfa902efaf..621333261733 100644
--- a/output/ulogd_output_JSON.c
+++ b/output/ulogd_output_JSON.c
@@ -303,10 +303,10 @@ static int json_interp(struct ulogd_pluginstance *upi)
 		t = localtime_r(&now, &result);
 		if (unlikely(*opi->cached_tz = '\0' || t->tm_gmtoff != opi->cached_gmtoff)) {
 			snprintf(opi->cached_tz, sizeof(opi->cached_tz),
-				 "%c%02d%02d",
+				 "%c%02ld%02ld",
 				 t->tm_gmtoff > 0 ? '+' : '-',
-				 abs(t->tm_gmtoff) / 60 / 60,
-				 abs(t->tm_gmtoff) / 60 % 60);
+				 labs(t->tm_gmtoff) / 60 / 60,
+				 labs(t->tm_gmtoff) / 60 % 60);
 		}
 
 		if (pp_is_valid(inp, opi->usec_idx)) {
-- 
2.33.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux