contrib/package: reap zombies in freifunk-watchdog, fix a warning
[project/luci.git] / contrib / package / freifunk-watchdog / src / watchdog.h
index 9c4d557..71c10e9 100644 (file)
@@ -29,6 +29,7 @@
 #include <math.h>
 #include <time.h>
 #include <signal.h>
+#include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
@@ -66,8 +67,8 @@
 #define WATCH_KEEPALIVE        '\0'
 
 /* System load error action and treshold */
-#define LOAD_TRESHOLD  5.00
-#define LOAD_ACTION            "/sbin/reboot"
+#define LOAD_TRESHOLD  15.00
+#define LOAD_ACTION            "/sbin/reboot", "/sbin/reboot"
 
 /* Fallback binary name (passed by makefile) */
 #ifndef BINARY
@@ -107,22 +108,20 @@ iw_ioctl(int                  skfd,           /* Socket to the kernel */
 }
 
 /* fork() & execl() helper */
-#define EXEC(x)                                                                                                                        \
-       do {                                                                                                                            \
-               switch(fork())                                                                                                  \
-               {                                                                                                                               \
-                       case -1:                                                                                                        \
-                               syslog(LOG_CRIT, "Unable to fork child: %s",                    \
-                                       strerror(errno));                                                                       \
-                                                                                                                                               \
-                                       break;                                                                                          \
-                                                                                                                                               \
-                               case 0:                                                                                                 \
-                                       execl(x, NULL);                                                                         \
-                                       syslog(LOG_CRIT, "Unable to execute action: %s",        \
-                                               strerror(errno));                                                               \
-                                                                                                                                               \
-                                       return 1;                                                                                       \
-               }                                                                                                                               \
+#define EXEC(x)                                                                                                                \
+       do {                                                                                                                    \
+               switch(fork())                                                                                          \
+               {                                                                                                                       \
+                       case -1:                                                                                                \
+                               syslog(LOG_CRIT, "Unable to fork child: %s",            \
+                                       strerror(errno));                                                               \
+                               break;                                                                                          \
+                                                                                                                                       \
+                       case 0:                                                                                                 \
+                               execl(x, NULL);                                                                         \
+                               syslog(LOG_CRIT, "Unable to execute action: %s",        \
+                                       strerror(errno));                                                               \
+                               return 1;                                                                                       \
+               }                                                                                                                       \
        } while(0)