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

Diff of /monit/util.c

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

revision 1.93 by martinp, Fri Sep 19 08:39:42 2003 UTC revision 1.94 by martinp, Fri Sep 19 09:17:06 2003 UTC
# Line 907  char *get_process_uptime(char *pidfile, Line 907  char *get_process_uptime(char *pidfile,
907    ASSERT(pidfile);    ASSERT(pidfile);
908    
909    if( (ctime= get_timestamp(pidfile, S_IFREG)) ) {    if( (ctime= get_timestamp(pidfile, S_IFREG)) ) {
910        
911      time_t now= time(&now);      time_t now= time(&now);
912      time_t since= now-ctime;      time_t since= now-ctime;
913    
914      return get_uptime(since,sep);      return get_uptime(since, sep);
915        
916    }    }
917    
918    return xstrdup("");    return xstrdup("");
919      
920  }  }
921    
922        
# Line 947  char *get_uptime(time_t delta, char *sep Line 947  char *get_uptime(time_t delta, char *sep
947      p+= snprintf(p, STRLEN-(p-buf),"%ldh%s", rest_h,sep);      p+= snprintf(p, STRLEN-(p-buf),"%ldh%s", rest_h,sep);
948      delta-= rest_h*hour;      delta-= rest_h*hour;
949    }    }
950      
951    rest_m= delta/min;    rest_m= delta/min;
952    p+= snprintf(p, STRLEN-(p-buf),"%ldm%s", rest_m,sep);    p+= snprintf(p, STRLEN-(p-buf),"%ldm%s", rest_m,sep);
953    delta-= rest_m*min;    delta-= rest_m*min;
# Line 1085  char *get_basic_authentication_header() Line 1085  char *get_basic_authentication_header()
1085        return xstrdup("\r\n");        return xstrdup("\r\n");
1086      }      }
1087    
1088      auth= xcalloc(sizeof(char *), STRLEN+1);      auth= xcalloc(sizeof(char), STRLEN+1);
1089      snprintf(auth, STRLEN, "Authorization: Basic %s\r\n", b64);      snprintf(auth, STRLEN, "Authorization: Basic %s\r\n", b64);
1090      free(b64);      free(b64);
1091    

Legend:
Removed from v.1.93  
changed lines
  Added in v.1.94

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