/[monit]/monit/files.c
ViewVC logotype

Diff of /monit/files.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by hauk, Fri Dec 20 17:45:38 2002 UTC revision 1.22 by hauk, Sat Dec 21 01:45:22 2002 UTC
# Line 70  void init_files() { Line 70  void init_files() {
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    
# Line 116  time_t get_timestamp(char *object, mode_ Line 115  time_t get_timestamp(char *object, mode_
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 {
# Line 151  char *find_rcfile() { Line 150  char *find_rcfile() {
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);
# Line 169  char *find_rcfile() { Line 168  char *find_rcfile() {
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",
# Line 218  int create_pidfile(char *pidfile) { Line 217  int create_pidfile(char *pidfile) {
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    
# Line 326  int check_file(char *filename, char *des Line 325  int check_file(char *filename, char *des
325            
326    }    }
327    
328    if(( buf.st_mode & 0777 ) & ~permmask) {    if((buf.st_mode & 0777 ) & ~permmask) {
329    
330      /*      /*
331         Explanation:         Explanation:

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26