74 } |
74 } |
75 |
75 |
76 //printf("1 time: %d - %d\n", f->last_modified, s.st_mtim.tv_sec); |
76 //printf("1 time: %d - %d\n", f->last_modified, s.st_mtim.tv_sec); |
77 if(f->last_modified != s.st_mtime) { |
77 if(f->last_modified != s.st_mtime) { |
78 /* reload the file */ |
78 /* reload the file */ |
79 printf("reload: %s\n", f->file.ptr); |
|
80 if(f->last_modified != 0) { |
79 if(f->last_modified != 0) { |
81 log_ereport( |
80 log_ereport( |
82 LOG_INFORM, |
81 LOG_INFORM, |
83 "reload configuration file: %s", |
82 "reload configuration file: %s", |
84 f->file.ptr); |
83 f->file.ptr); |
110 return -1; |
109 return -1; |
111 } |
110 } |
112 |
111 |
113 ServerConfiguration *config; |
112 ServerConfiguration *config; |
114 if(cfgreload || !current_config || sc_last_modified != s.st_mtime) { |
113 if(cfgreload || !current_config || sc_last_modified != s.st_mtime) { |
115 printf("cfgmgr load server.conf\n"); |
|
116 config = load_server_conf( |
114 config = load_server_conf( |
117 current_config, |
115 current_config, |
118 "config/server.conf"); |
116 "config/server.conf"); |
119 |
117 |
120 if(config == NULL) { |
118 if(config == NULL) { |
121 fprintf(stderr, "Cannot load server.conf\n"); |
|
122 return -1; |
119 return -1; |
123 } |
120 } |
124 |
121 |
125 sc_last_modified = s.st_mtime; |
122 sc_last_modified = s.st_mtime; |
126 } else { |
123 } else { |
127 printf("no reconfig required!\n"); |
124 log_ereport(LOG_VERBOSE, "no reconfig required"); |
128 config = current_config; |
125 config = current_config; |
129 } |
126 } |
130 |
127 |
131 if(set_cfg) { |
128 if(set_cfg) { |
132 *set_cfg = config; |
129 *set_cfg = config; |