#define CF_FILE_NONE (0)
#define CF_FILE_ERROR (1)
-#define CF_FILE_CONFIG (2)
-#define CF_FILE_MODULE (3)
+#define CF_FILE_CONFIG (1 << 2)
+#define CF_FILE_MODULE (1 << 3)
int cf_file_changed(CONF_SECTION *cs);
extern CONF_SECTION *root_config;
* The file changed, we'll need to re-read it.
*/
if (buf.st_mtime != file->buf.st_mtime) {
- /*
- * Set none -> whatever
- */
- if (*rcode == CF_FILE_NONE) {
- if (!file->input) {
- *rcode = CF_FILE_CONFIG;
- return 1;
- }
-
- *rcode = CF_FILE_MODULE;
- return 0;
-
- }
-
- /*
- * A module WAS changed, but now we discover that
- * a main config file has changed. We might as
- * well re-load everything.
- */
- if ((*rcode == CF_FILE_MODULE) && !file->input) {
- *rcode = CF_FILE_CONFIG;
- return 1;
+ if (!file->input) {
+ *rcode |= CF_FILE_CONFIG;
+ } else {
+ *rcode |= CF_FILE_MODULE;
}
}
return;
}
- if (rcode == CF_FILE_MODULE) {
- INFO("HUP - Files loaded by a module have changed.");
+ /*
+ * No config files have changed.
+ */
+ if ((rcode & CF_FILE_CONFIG) == 0) {
+ if ((rcode & CF_FILE_MODULE) != 0) {
+ INFO("HUP - Files loaded by a module have changed.");
+
+ /*
+ * FIXME: reload the module.
+ */
+
+ }
return;
}