src/server/daemon/configmanager.c

changeset 69
4a10bc0ee80d
parent 62
c47e081b6c0f
child 74
5bc6d078fb2c
equal deleted inserted replaced
68:f5102a892ed4 69:4a10bc0ee80d
103 perror("cfgmgr_load_config: stat"); 103 perror("cfgmgr_load_config: stat");
104 return -1; 104 return -1;
105 } 105 }
106 106
107 //printf("1 time: %d - %d\n", f->last_modified, s.st_mtim.tv_sec); 107 //printf("1 time: %d - %d\n", f->last_modified, s.st_mtim.tv_sec);
108 if(f->last_modified != s.st_mtim.tv_sec) { 108 if(f->last_modified != s.st_mtime) {
109 /* reload the file */ 109 /* reload the file */
110 printf("reload: %s\n", f->file.ptr); 110 printf("reload: %s\n", f->file.ptr);
111 log_ereport( 111 log_ereport(
112 LOG_INFORM, 112 LOG_INFORM,
113 "reload configuration file: %s", 113 "reload configuration file: %s",
114 f->file.ptr); 114 f->file.ptr);
115 f->reload(f, conf); 115 f->reload(f, conf);
116 f->last_modified = s.st_mtim.tv_sec; 116 f->last_modified = s.st_mtime;
117 if(reload) { 117 if(reload) {
118 *reload = 1; 118 *reload = 1;
119 } 119 }
120 } 120 }
121 return 0; 121 return 0;
150 if(config == NULL) { 150 if(config == NULL) {
151 fprintf(stderr, "Cannot load server.conf\n"); 151 fprintf(stderr, "Cannot load server.conf\n");
152 return -1; 152 return -1;
153 } 153 }
154 154
155 sc_last_modified = s.st_mtim.tv_sec; 155 sc_last_modified = s.st_mtime;
156 } else if(0) { 156 } else if(0) {
157 /* copy configuration */ 157 /* copy configuration */
158 printf("cfgmgr copy server.conf\n"); 158 printf("cfgmgr copy server.conf\n");
159 159
160 /* TODO: copy */ 160 /* TODO: copy */

mercurial