comparison src/routeflapper.cpp @ 4:180d26aa2a17

Fedora 9 compile and const correctness.
author Carl Byington <carl@five-ten-sg.com>
date Thu, 12 Jun 2008 17:51:33 -0700
parents 4a81cc2da570
children
comparison
equal deleted inserted replaced
3:4a81cc2da570 4:180d26aa2a17
46 46
47 47
48 //////////////////////////////////////////////// 48 ////////////////////////////////////////////////
49 // syslog a message 49 // syslog a message
50 // 50 //
51 void my_syslog(char *text) 51 void my_syslog(const char *text)
52 { 52 {
53 if (use_syslog) { 53 if (use_syslog) {
54 pthread_mutex_lock(&syslog_mutex); 54 pthread_mutex_lock(&syslog_mutex);
55 if (!syslog_opened) { 55 if (!syslog_opened) {
56 openlog("routeflapper", LOG_PID, LOG_AUTHPRIV); 56 openlog("routeflapper", LOG_PID, LOG_AUTHPRIV);
104 sleep(period); 104 sleep(period);
105 } 105 }
106 if (!loader_run) break; // ... so we only wait about 3 minutes to terminate 106 if (!loader_run) break; // ... so we only wait about 3 minutes to terminate
107 routing_hourly_update(); // roughly an hour 107 routing_hourly_update(); // roughly an hour
108 } 108 }
109 return NULL;
109 } 110 }
110 111
111 112
112 //////////////////////////////////////////////// 113 ////////////////////////////////////////////////
113 // thread to watch the old config files for changes 114 // thread to watch the old config files for changes
123 CONFIG &dc = *config; 124 CONFIG &dc = *config;
124 time_t then = dc.load_time; 125 time_t then = dc.load_time;
125 struct stat st; 126 struct stat st;
126 bool reload = false; 127 bool reload = false;
127 for (string_set::iterator i=dc.config_files.begin(); i!=dc.config_files.end(); i++) { 128 for (string_set::iterator i=dc.config_files.begin(); i!=dc.config_files.end(); i++) {
128 char *fn = *i; 129 const char *fn = *i;
129 if (stat(fn, &st)) reload = true; // file disappeared 130 if (stat(fn, &st)) reload = true; // file disappeared
130 else if (st.st_mtime > then) reload = true; // file modified 131 else if (st.st_mtime > then) reload = true; // file modified
131 if (reload) break; 132 if (reload) break;
132 } 133 }
133 if (reload) { 134 if (reload) {