1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
$NetBSD: patch-ad,v 1.1.1.1 2007/04/30 20:53:54 heinz Exp $
Pre-processor macro SYSCONFDIR will be defined on the command line.
SYSCONFDIR has to be a string enclosed by "" to enable string literal
concatenation.
--- file.c.orig 2007-01-03 22:02:06.000000000 +0100
+++ file.c
@@ -145,9 +145,9 @@ time_t File_getTimestamp(char *object, m
/**
* Search the system for the monit control file. Try first ~/.monitrc,
- * if that fails try /etc/monitrc, then /usr/local/etc/monitrc and
- * finally ./monitrc. Exit the application if the control file was
- * not found.
+ * if that fails try /etc/monitrc, then SYSCONFDIR/monitrc (default:
+ * /usr/local/etc/monitrc) and finally ./monitrc.
+ * Exit the application if the control file was not found.
* @return The location of monits control file (monitrc)
*/
char *File_findControlFile() {
@@ -164,7 +164,7 @@ char *File_findControlFile() {
return (rcfile);
}
memset(rcfile, 0, STRLEN);
- snprintf(rcfile, STRLEN, "/usr/local/etc/%s", MONITRC);
+ snprintf(rcfile, STRLEN, SYSCONFDIR "/%s", MONITRC);
if(File_exist(rcfile)) {
return (rcfile);
}
@@ -174,7 +174,7 @@ char *File_findControlFile() {
return (rcfile);
}
LogError("%s: Cannot find the control file at "
- "~/.%s, /etc/%s, /usr/local/etc/%s or at ./%s \n",
+ "~/.%s, /etc/%s, " SYSCONFDIR "/%s or at ./%s \n",
prog, MONITRC, MONITRC, MONITRC, MONITRC);
exit(1);
|