summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netmon.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/netmon.c b/netmon.c
index fb8bf66..2c500d9 100644
--- a/netmon.c
+++ b/netmon.c
@@ -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;