120 |
|
|
121 |
if( ((type == S_IFREG) && S_ISREG(buf.st_mode)) || |
if( ((type == S_IFREG) && S_ISREG(buf.st_mode)) || |
122 |
((type == S_IFDIR) && S_ISDIR(buf.st_mode)) || |
((type == S_IFDIR) && S_ISDIR(buf.st_mode)) || |
123 |
((type == (S_IFREG|S_IFDIR)) && (S_ISREG(buf.st_mode) || S_ISDIR(buf.st_mode))) |
((type == (S_IFREG|S_IFDIR)) && (S_ISREG(buf.st_mode) || |
124 |
|
S_ISDIR(buf.st_mode))) |
125 |
) { |
) { |
126 |
|
|
127 |
return MAXIMUM(buf.st_mtime, buf.st_ctime); |
return MAXIMUM(buf.st_mtime, buf.st_ctime); |
128 |
|
|
129 |
} else { |
} else { |
130 |
|
|
131 |
error("%s: Invalid object type - %s\n", prog, object); |
log("%s: Invalid object type - %s\n", prog, object); |
132 |
|
|
133 |
} |
} |
134 |
|
|
135 |
} else { |
} else { |
136 |
|
|
137 |
error("%s: Cannot stat object - %s\n", prog, object); |
log("%s: Cannot stat object - %s\n", prog, object); |
138 |
|
|
139 |
} |
} |
140 |
|
|
176 |
if ( exist_file(rcfile) ) |
if ( exist_file(rcfile) ) |
177 |
return (rcfile); |
return (rcfile); |
178 |
|
|
179 |
error("%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", |
180 |
prog, MONITRC, MONITRC, MONITRC); |
prog, MONITRC, MONITRC, MONITRC); |
181 |
|
|
182 |
exit(1); |
exit(1); |
183 |
|
|
200 |
|
|
201 |
if ((F= fopen(pidfile,"w")) == (FILE *)NULL) { |
if ((F= fopen(pidfile,"w")) == (FILE *)NULL) { |
202 |
|
|
203 |
error("%s: Error opening pidfile '%s' for writing -- %s\n", |
log("%s: Error opening pidfile '%s' for writing -- %s\n", |
204 |
prog, pidfile, STRERROR); |
prog, pidfile, STRERROR); |
205 |
|
|
206 |
return(FALSE); |
return(FALSE); |
207 |
|
|
296 |
|
|
297 |
if(lstat(filename, &buf) < 0) { |
if(lstat(filename, &buf) < 0) { |
298 |
|
|
299 |
error("%s: Cannot stat the %s '%s' -- %s\n", |
log("%s: Cannot stat the %s '%s' -- %s\n", |
300 |
prog, description, filename, STRERROR); |
prog, description, filename, STRERROR); |
301 |
|
|
302 |
return FALSE; |
return FALSE; |
303 |
|
|
305 |
|
|
306 |
if(S_ISLNK(buf.st_mode)) { |
if(S_ISLNK(buf.st_mode)) { |
307 |
|
|
308 |
error("%s: The %s '%s' must not be a symbolic link.\n", |
log("%s: The %s '%s' must not be a symbolic link.\n", |
309 |
prog, description, filename); |
prog, description, filename); |
310 |
|
|
311 |
return(FALSE); |
return(FALSE); |
312 |
|
|
314 |
|
|
315 |
if(!S_ISREG(buf.st_mode)) { |
if(!S_ISREG(buf.st_mode)) { |
316 |
|
|
317 |
error("%s: The %s '%s' is not a regular file.\n", |
log("%s: The %s '%s' is not a regular file.\n", |
318 |
prog, description, filename); |
prog, description, filename); |
319 |
|
|
320 |
return FALSE; |
return FALSE; |
321 |
|
|
323 |
|
|
324 |
if(buf.st_uid != geteuid()) { |
if(buf.st_uid != geteuid()) { |
325 |
|
|
326 |
error("%s: The %s '%s' must be owned by you.\n", |
log("%s: The %s '%s' must be owned by you.\n", |
327 |
prog, description, filename); |
prog, description, filename); |
328 |
|
|
329 |
return FALSE; |
return FALSE; |
330 |
|
|
342 |
permissions set than in permmask |
permissions set than in permmask |
343 |
*/ |
*/ |
344 |
|
|
345 |
error("%s: The %s '%s' must have permissions no more " |
log("%s: The %s '%s' must have permissions no more " |
346 |
"than -%c%c%c%c%c%c%c%c%c (0%o); " |
"than -%c%c%c%c%c%c%c%c%c (0%o); " |
347 |
"right now permissions are -%c%c%c%c%c%c%c%c%c (0%o).\n", |
"right now permissions are -%c%c%c%c%c%c%c%c%c (0%o).\n", |
348 |
prog, description, filename, |
prog, description, filename, |
349 |
permmask&S_IRUSR?'r':'-', |
permmask&S_IRUSR?'r':'-', |
350 |
permmask&S_IWUSR?'w':'-', |
permmask&S_IWUSR?'w':'-', |
351 |
permmask&S_IXUSR?'x':'-', |
permmask&S_IXUSR?'x':'-', |
352 |
permmask&S_IRGRP?'r':'-', |
permmask&S_IRGRP?'r':'-', |
353 |
permmask&S_IWGRP?'w':'-', |
permmask&S_IWGRP?'w':'-', |
354 |
permmask&S_IXGRP?'x':'-', |
permmask&S_IXGRP?'x':'-', |
355 |
permmask&S_IROTH?'r':'-', |
permmask&S_IROTH?'r':'-', |
356 |
permmask&S_IWOTH?'w':'-', |
permmask&S_IWOTH?'w':'-', |
357 |
permmask&S_IXOTH?'x':'-', |
permmask&S_IXOTH?'x':'-', |
358 |
permmask&0777, |
permmask&0777, |
359 |
buf.st_mode&S_IRUSR?'r':'-', |
buf.st_mode&S_IRUSR?'r':'-', |
360 |
buf.st_mode&S_IWUSR?'w':'-', |
buf.st_mode&S_IWUSR?'w':'-', |
361 |
buf.st_mode&S_IXUSR?'x':'-', |
buf.st_mode&S_IXUSR?'x':'-', |
362 |
buf.st_mode&S_IRGRP?'r':'-', |
buf.st_mode&S_IRGRP?'r':'-', |
363 |
buf.st_mode&S_IWGRP?'w':'-', |
buf.st_mode&S_IWGRP?'w':'-', |
364 |
buf.st_mode&S_IXGRP?'x':'-', |
buf.st_mode&S_IXGRP?'x':'-', |
365 |
buf.st_mode&S_IROTH?'r':'-', |
buf.st_mode&S_IROTH?'r':'-', |
366 |
buf.st_mode&S_IWOTH?'w':'-', |
buf.st_mode&S_IWOTH?'w':'-', |
367 |
buf.st_mode&S_IXOTH?'x':'-', |
buf.st_mode&S_IXOTH?'x':'-', |
368 |
buf.st_mode& 0777); |
buf.st_mode& 0777); |
369 |
|
|
370 |
return FALSE; |
return FALSE; |
371 |
|
|