You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
2.3 KiB

Index: configure
--- configure.orig 2020-10-24 20:27:04.000000000 +0200
+++ configure 2020-10-27 19:28:16.991195000 +0100
@@ -13376,6 +13376,7 @@
for ac_header in \
+ sys/types.h \
alloca.h \
arpa/inet.h \
asm/page.h \
Index: src/file.c
--- src/file.c.orig 2020-10-24 20:26:57.000000000 +0200
+++ src/file.c 2020-10-27 19:32:30.067795000 +0100
@@ -101,6 +101,9 @@
Util_monitId(Run.files.id);
/* Set the location of monit's state file */
if (Run.files.state == NULL) {
+ if (!getuid())
+ snprintf(buf, STRLEN, "%s/%s", MYSTATEDIR, MYSTATEFILE);
+ else
snprintf(buf, STRLEN, "%s/.%s", Run.Env.home, MYSTATEFILE);
Run.files.state = Str_dup(buf);
}
@@ -115,27 +118,11 @@
char *file_findControlFile() {
char *rcfile = CALLOC(sizeof(char), STRLEN + 1);
- snprintf(rcfile, STRLEN, "%s/.%s", Run.Env.home, MONITRC);
+ snprintf(rcfile, STRLEN, "@l_prefix@/etc/monit/%s", MONITRC);
if (File_exist(rcfile)) {
return rcfile;
}
- snprintf(rcfile, STRLEN, "/etc/%s", MONITRC);
- if (File_exist(rcfile)) {
- return rcfile;
- }
- snprintf(rcfile, STRLEN, "%s/%s", SYSCONFDIR, MONITRC);
- if (File_exist(rcfile)) {
- return rcfile;
- }
- snprintf(rcfile, STRLEN, "/usr/local/etc/%s", MONITRC);
- if (File_exist(rcfile)) {
- return rcfile;
- }
- if (File_exist(MONITRC)) {
- snprintf(rcfile, STRLEN, "%s/%s", Run.Env.cwd, MONITRC);
- return rcfile;
- }
- Log_error("Cannot find the Monit control file at ~/.%s, /etc/%s, %s/%s, /usr/local/etc/%s or at ./%s \n", MONITRC, MONITRC, SYSCONFDIR, MONITRC, MONITRC, MONITRC);
+ Log_error("Cannot find the control file at %s\n", rcfile);
exit(1);
}
Index: src/monit.h
--- src/monit.h.orig 2020-10-24 20:26:57.000000000 +0200
+++ src/monit.h 2020-10-27 19:28:16.992154000 +0100
@@ -124,6 +124,7 @@
#define ARGMAX 64
#define MYPIDDIR PIDDIR
+#define MYSTATEDIR PIDDIR
#define MYPIDFILE "monit.pid"
#define MYSTATEFILE "monit.state"
#define MYIDFILE "monit.id"