| diff -aru monit-5.4/src/daemonize.c monit-edited/src/daemonize.c |
| --- monit-5.4/src/daemonize.c 2012-05-06 02:40:45.000000000 -0700 |
| +++ monit-edited/src/daemonize.c 2016-01-07 17:54:13.979175325 -0800 |
| @@ -61,6 +61,7 @@ |
| #include <string.h> |
| #endif |
| |
| +#include <sys/reboot.h> |
| #include "monit.h" |
| |
| |
| @@ -93,8 +94,9 @@ |
| */ |
| if((pid= fork ()) < 0) { |
| |
| - LogError("Cannot fork of a new process\n"); |
| - exit (1); |
| + LogError("Cannot fork of a new process, rebooting\n"); |
| + sync(); |
| + reboot(RB_AUTOBOOT); |
| |
| } |
| else if(pid != 0) { |
| @@ -107,8 +109,9 @@ |
| |
| if((pid= fork ()) < 0) { |
| |
| - LogError("Cannot fork of a new process\n"); |
| - exit (1); |
| + LogError("Cannot fork of a new process, rebooting\n"); |
| + sync(); |
| + reboot(RB_AUTOBOOT); |
| |
| } |
| else if(pid != 0) { |
| Only in monit-edited/src: .daemonize.c.swp |
| diff -aru monit-5.4/src/spawn.c monit-edited/src/spawn.c |
| --- monit-5.4/src/spawn.c 2016-01-07 14:15:22.132302393 -0800 |
| +++ monit-edited/src/spawn.c 2016-01-07 17:53:54.130841558 -0800 |
| @@ -64,10 +64,13 @@ |
| #include <sys/stat.h> |
| #endif |
| |
| + |
| #ifdef HAVE_FCNTL_H |
| #include <fcntl.h> |
| #endif |
| |
| +#include <sys/reboot.h> |
| + |
| #include "event.h" |
| #include "alert.h" |
| #include "monit.h" |
| @@ -157,8 +160,9 @@ |
| |
| pid= fork(); |
| if(pid < 0) { |
| - LogError("Cannot fork a new process: %s\n", strerror(errno)); |
| - exit(1); |
| + LogError("Cannot fork a new process, rebooting: %s\n", strerror(errno)); |
| + sync(); |
| + reboot(RB_AUTOBOOT); |
| } |
| |
| if(pid == 0) { |
| Only in monit-edited/src: .spawn.c.swp |