From 88c7720caf2d3d146a2a38f775767719dadb5141 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Mon, 3 Feb 2014 08:13:14 -0500 Subject: [PATCH] These may not be longs (eg: OSX)... fo a safe cast to ensure. --- api.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api.c b/api.c index 3dac1ade..425c242f 100644 --- a/api.c +++ b/api.c @@ -1005,9 +1005,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson sprintf(buf, "%s", *((bool *)(root->data)) ? TRUESTR : FALSESTR); break; case API_TIMEVAL: - sprintf(buf, "%ld.%06ld", - ((struct timeval *)(root->data))->tv_sec, - ((struct timeval *)(root->data))->tv_usec); + snprintf(buf, sizeof(buf), "%ld.%06ld", + (long)((struct timeval *)(root->data))->tv_sec, + (long)((struct timeval *)(root->data))->tv_usec); break; case API_TEMP: sprintf(buf, "%.2f", *((float *)(root->data)));