From 07f9c438f31de7a280e43c4196a32d200ad41fbe Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:10:55 +0200 Subject: Fixes for -Wsign-compare --- plugins/check_ups.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins/check_ups.c') diff --git a/plugins/check_ups.c b/plugins/check_ups.c index d1ded620..bb91c4ad 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -402,7 +402,8 @@ get_ups_variable (const char *varname, char *buf) /* create the command string to send to the UPS daemon */ /* Add LOGOUT to avoid read failure logs */ - if (snprintf (send_buffer, sizeof(send_buffer), "GET VAR %s %s\nLOGOUT\n", ups_name, varname) >= sizeof(send_buffer)) { + int res = snprintf (send_buffer, sizeof(send_buffer), "GET VAR %s %s\nLOGOUT\n", ups_name, varname); + if ( (res > 0) && ((size_t)res >= sizeof(send_buffer))) { printf("%s\n", _("UPS name to long for buffer")); return ERROR; } -- cgit v1.2.3-74-g34f1