| 1 |
From 155e35ace12f41bbaa42e4ea19bfea6de416bd95 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Sebastian Andrzej Siewior <[email protected]> |
| 3 |
Date: Fri, 22 Mar 2024 19:48:09 +0100 |
| 4 |
Subject: [PATCH] Compile warnings. |
| 5 |
|
| 6 |
Address various compile warnings in check_memcached. |
| 7 |
|
| 8 |
Signed-off-by: Sebastian Andrzej Siewior <[email protected]> |
| 9 |
--- |
| 10 |
check_memcached/check_memcached.l | 14 +++++++------- |
| 11 |
common.mk | 2 +- |
| 12 |
2 files changed, 8 insertions(+), 8 deletions(-) |
| 13 |
|
| 14 |
--- a/check_memcached/check_memcached.l |
| 15 |
+++ b/check_memcached/check_memcached.l |
| 16 |
@@ -152,7 +152,7 @@ cmd_set= { save_to = &obj_cmd_set; } |
| 17 |
%% |
| 18 |
/* ==================================================================================================== */ |
| 19 |
|
| 20 |
-yywrap() { |
| 21 |
+int yywrap(void) { |
| 22 |
return 1; |
| 23 |
} |
| 24 |
|
| 25 |
@@ -343,7 +343,7 @@ int check_memcached() { |
| 26 |
} |
| 27 |
|
| 28 |
if ( nagios_service_output == NULL ) { |
| 29 |
- str_bytes = asprintf(&nagios_service_output,""); |
| 30 |
+ str_bytes = asprintf(&nagios_service_output," "); |
| 31 |
} |
| 32 |
/* ----------------------------------------------------------------------------------------- */ |
| 33 |
/* ---- Analyze the stats, return 0,1,2 as required ---------------------------------------- */ |
| 34 |
@@ -351,7 +351,7 @@ int check_memcached() { |
| 35 |
if ( obj_time == 0 ) { |
| 36 |
nagios_service_tmp = nagios_service_output; |
| 37 |
str_bytes = asprintf(&nagios_service_output, |
| 38 |
- "%sno stats available yet. Come back in %d minutes; ", |
| 39 |
+ "%sno stats available yet. Come back in %" PRIu64 " minutes; ", |
| 40 |
nagios_service_tmp, |
| 41 |
min_stats_interval - (stats.time - obj_time_oldest ) / 60 |
| 42 |
); |
| 43 |
@@ -362,7 +362,7 @@ int check_memcached() { |
| 44 |
nagios_result|=1; |
| 45 |
nagios_service_tmp = nagios_service_output; |
| 46 |
str_bytes = asprintf(&nagios_service_output, |
| 47 |
- "%sToo many evictions: %d; ", |
| 48 |
+ "%sToo many evictions: %llu; ", |
| 49 |
nagios_service_tmp, |
| 50 |
stats.evictions - obj_evictions |
| 51 |
); |
| 52 |
@@ -399,7 +399,7 @@ int check_memcached() { |
| 53 |
|
| 54 |
nagios_service_tmp = nagios_service_output; |
| 55 |
str_bytes = asprintf(&nagios_service_output, |
| 56 |
- "%shits=%llu misses=%llu evictions=%llu interval=%lu mins", |
| 57 |
+ "%shits=%llu misses=%llu evictions=%llu interval=%u mins", |
| 58 |
nagios_service_tmp, |
| 59 |
stats.get_hits - obj_get_hits, |
| 60 |
stats.get_misses - obj_get_misses, |
| 61 |
@@ -453,7 +453,7 @@ int check_memcached() { |
| 62 |
nagios_perfdata = ""; |
| 63 |
} else { |
| 64 |
str_bytes = asprintf(&nagios_perfdata, |
| 65 |
- "%s delta_time=%lu delta_cmd_get=%llu delta_cmd_set=%llu delta_get_hits=%llu delta_get_misses=%llu delta_evictions=%llu", |
| 66 |
+ "%s delta_time=%u delta_cmd_get=%llu delta_cmd_set=%llu delta_get_hits=%llu delta_get_misses=%llu delta_evictions=%llu", |
| 67 |
current_stats_str, |
| 68 |
(uint32_t) ( stats.time - obj_time ), |
| 69 |
stats.cmd_get - obj_cmd_get, |
| 70 |
@@ -600,7 +600,7 @@ void usage() { |
| 71 |
printf("\t-n ... Keep up to this many items in the history object in memcached (default: %u)\n",max_n_stats); |
| 72 |
printf("\t-T ... Minimum time interval (in minutes) to use to analyse stats. (default: %u)\n",min_stats_interval); |
| 73 |
printf("\t-w ... Generate warning if quotient of hits/misses falls below this value (default: %1.1f)\n",min_hit_miss); |
| 74 |
- printf("\t-E ... Generate warning if number of evictions exceeds this threshold. 0=disable. (default: %llu)\n",max_evictions); |
| 75 |
+ printf("\t-E ... Generate warning if number of evictions exceeds this threshold. 0=disable. (default: %" PRIu64 ")\n",max_evictions); |
| 76 |
printf("\t-t ... timeout in seconds (default: %1.1f)\n",timeout); |
| 77 |
printf("\t-k ... key name for history object (default: %s)\n",memcached_key); |
| 78 |
printf("\t-K ... expiry time in seconds for history object (default: %u)\n",memcache_stats_object_expiry_time); |
| 79 |
--- a/common.mk |
| 80 |
+++ b/common.mk |
| 81 |
@@ -1,6 +1,6 @@ |
| 82 |
|
| 83 |
# import buildflags |
| 84 |
-CFLAGS += $(shell dpkg-buildflags --get CFLAGS) |
| 85 |
+CFLAGS += $(shell dpkg-buildflags --get CFLAGS) -D_GNU_SOURCE |
| 86 |
CPPFLAGS += $(shell dpkg-buildflags --get CPPFLAGS) |
| 87 |
CXXFLAGS += $(shell dpkg-buildflags --get CXXFLAGS) |
| 88 |
LDFLAGS += $(shell dpkg-buildflags --get LDFLAGS) |