diff options
author | Keuin <[email protected]> | 2021-12-28 06:00:43 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2021-12-28 06:00:43 +0800 |
commit | fdad8c8db14c87d5a64226e9372b0db7d79bcbfc (patch) | |
tree | 7e9e0a8cdbabf1100cc47057d9a99b41dab632f7 /netmon.c | |
parent | 0a6f3b2c456e54b9bcf0aceb7151d6c989f9d93b (diff) |
Log failure count when network failure is detected. Explicit boundary limiting.v1.0.0
Diffstat (limited to 'netmon.c')
-rw-r--r-- | netmon.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -28,7 +28,7 @@ void daemonize() { } if (pid > 0) { char buf[32]; - sprintf(buf, "Child process: %d", pid); + snprintf(buf, 31, "Child process: %d", pid); log_info(logger, buf); exit(0); // exit parent process } @@ -180,8 +180,10 @@ void loop() { while (1) { log_info(logger, "Check network."); if (check_network() != 0) { - log_info(logger, "Network failure detected."); ++failures; + char buf[64]; + snprintf(buf, 63, "Network failure detected. counter=%d", failures); + log_info(logger, buf); } else { log_info(logger, "Network is OK."); failures = 0; |