70 |
char pidfile[STRLEN]; |
char pidfile[STRLEN]; |
71 |
|
|
72 |
/* Check if the pidfile was already set during configfile parsing */ |
/* Check if the pidfile was already set during configfile parsing */ |
73 |
|
if(Run.pidfile == NULL) { |
|
if( Run.pidfile == NULL ) { |
|
74 |
|
|
75 |
/* Set the location of this programs pidfile */ |
/* Set the location of this programs pidfile */ |
76 |
if( !getuid() ) { |
if(! getuid()) { |
77 |
|
|
78 |
snprintf(pidfile, STRLEN, "%s/%s", MYPIDDIR, MYPIDFILE); |
snprintf(pidfile, STRLEN, "%s/%s", MYPIDDIR, MYPIDFILE); |
79 |
|
|
115 |
|
|
116 |
ASSERT(object); |
ASSERT(object); |
117 |
|
|
118 |
if( !stat(object, &buf) ) { |
if(! stat(object, &buf)) { |
119 |
|
|
120 |
if( ((type == S_IFREG) && S_ISREG(buf.st_mode)) || |
if(((type == S_IFREG) && S_ISREG(buf.st_mode)) || |
121 |
((type == S_IFDIR) && S_ISDIR(buf.st_mode)) || |
((type == S_IFDIR) && S_ISDIR(buf.st_mode)) || |
122 |
((type == (S_IFREG|S_IFDIR)) && (S_ISREG(buf.st_mode) || |
((type == (S_IFREG|S_IFDIR)) && (S_ISREG(buf.st_mode) || |
123 |
S_ISDIR(buf.st_mode))) |
S_ISDIR(buf.st_mode))) |
124 |
) { |
) { |
125 |
|
|
126 |
return MAXIMUM(buf.st_mtime, buf.st_ctime); |
return MAXIMUM(buf.st_mtime, buf.st_ctime); |
127 |
|
|
128 |
} else { |
} else { |
150 |
|
|
151 |
snprintf(rcfile, STRLEN, "%s/.%s", Run.Env.home, MONITRC); |
snprintf(rcfile, STRLEN, "%s/.%s", Run.Env.home, MONITRC); |
152 |
|
|
153 |
if ( exist_file(rcfile) ) { |
if(exist_file(rcfile)) { |
154 |
|
|
155 |
return (rcfile); |
return (rcfile); |
156 |
|
|
157 |
} |
} |
158 |
|
|
159 |
if ( exist_file(MONITRC) ) { |
if(exist_file(MONITRC)) { |
160 |
|
|
161 |
memset(rcfile, 0, STRLEN); |
memset(rcfile, 0, STRLEN); |
162 |
snprintf(rcfile, STRLEN, "%s/%s", Run.Env.cwd, MONITRC); |
snprintf(rcfile, STRLEN, "%s/%s", Run.Env.cwd, MONITRC); |
168 |
memset(rcfile, 0, STRLEN); |
memset(rcfile, 0, STRLEN); |
169 |
snprintf(rcfile, STRLEN, "/etc/%s", MONITRC); |
snprintf(rcfile, STRLEN, "/etc/%s", MONITRC); |
170 |
|
|
171 |
if ( exist_file(rcfile) ) |
if(exist_file(rcfile)) |
172 |
return (rcfile); |
return (rcfile); |
173 |
|
|
174 |
log("%s: Cannot find the control file at ~/.%s, ./%s or at /etc/%s\n", |
log("%s: Cannot find the control file at ~/.%s, ./%s or at /etc/%s\n", |
217 |
*/ |
*/ |
218 |
int is_rcfile_changed() { |
int is_rcfile_changed() { |
219 |
|
|
220 |
return( get_timestamp(Run.controlfile, S_IFREG) != Run.timestamp ); |
return(get_timestamp(Run.controlfile, S_IFREG) != Run.timestamp); |
221 |
|
|
222 |
} |
} |
223 |
|
|
325 |
|
|
326 |
} |
} |
327 |
|
|
328 |
if(( buf.st_mode & 0777 ) & ~permmask) { |
if((buf.st_mode & 0777 ) & ~permmask) { |
329 |
|
|
330 |
/* |
/* |
331 |
Explanation: |
Explanation: |