[monitoring-plugins] Fix another sscanf instance

Lorenz Kästle git at monitoring-plugins.org
Wed Mar 12 18:00:15 CET 2025


 Module: monitoring-plugins
 Branch: master
 Commit: 04c5e4024fd922cdae4b6b302668af44187c1193
 Author: Lorenz Kästle <12514511+RincewindsHat at users.noreply.github.com>
   Date: Wed Mar 12 17:26:32 2025 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=04c5e402

Fix another sscanf instance

---

 plugins/check_ping.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index 8d8ae7df..940b9475 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -481,7 +481,8 @@ ping_result run_ping(const char *cmd, const char *addr, double crta) {
 			(sscanf(buf, "%*d packets transmitted, %*d packets received, %d%% packet loss%n", &result.packet_loss, &match) == 1 && match) ||
 			(sscanf(buf, "%*d packets transmitted, %*d packets received, %d%% loss, time%n", &result.packet_loss, &match) == 1 && match) ||
 			(sscanf(buf, "%*d packets transmitted, %*d received, %d%% loss, time%n", &result.packet_loss, &match) == 1 && match) ||
-			(sscanf(buf, "%*d packets transmitted, %*d received, %d%% packet loss, time%n", &result.packet_loss, &match) && match) == 1 ||
+			(sscanf(buf, "%*d packets transmitted, %*d received, %d%% packet loss, time%n", &result.packet_loss, &match) == 1 && match) ==
+				1 ||
 			(sscanf(buf, "%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss%n", &result.packet_loss, &match) == 1 &&
 			 match) ||
 			(sscanf(buf, "%*d packets transmitted %*d received, +%*d errors, %d%% packet loss%n", &result.packet_loss, &match) == 1 &&



More information about the Commits mailing list