]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Make the "file changed" flag into a bitfield
authorAlan T. DeKok <aland@freeradius.org>
Wed, 2 Sep 2015 17:31:02 +0000 (13:31 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 2 Sep 2015 17:31:02 +0000 (13:31 -0400)
src/include/conffile.h
src/main/conffile.c
src/main/mainconfig.c

index 596c20afa9763b633ab8e9503d6d4864f9f61117..3ca330f260c5778a1c79e430f56e52659950853a 100644 (file)
@@ -290,8 +290,8 @@ CONF_ITEM *cf_reference_item(CONF_SECTION const *parentcs,
 
 #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;
index 8cdeaab3dfb8b246079297bf4e27c2531fbc4854..cad30b4191c93109b71684b56fd60278d089f28c 100644 (file)
@@ -433,28 +433,10 @@ static int file_callback(void *ctx, void *data)
         *      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;
                }
        }
 
index de7d5d3e6eae5047dd15d12f222d630e46727a71..8b5e889283db163df7780a0d016cb61c714a862a 100644 (file)
@@ -1108,8 +1108,18 @@ void main_config_hup(void)
                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;
        }