]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Correctly check for config / module HUP
authorAlan T. DeKok <aland@freeradius.org>
Thu, 23 Jun 2016 21:00:00 +0000 (17:00 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 23 Jun 2016 21:00:00 +0000 (17:00 -0400)
src/main/conffile.c
src/main/mainconfig.c

index c2047426427e0a4f29035bad2b05b8b4ccab6707..611c3867ab56e3e828169e240c58a20ac2993419 100644 (file)
@@ -122,7 +122,6 @@ struct conf_part {
 typedef struct cf_file_t {
        char const      *filename;
        CONF_SECTION    *cs;
-       bool            input;
        struct stat     buf;
 } cf_file_t;
 
@@ -333,7 +332,6 @@ static FILE *cf_file_open(CONF_SECTION *cs, char const *filename)
 
        file->filename = filename;
        file->cs = cs;
-       file->input = true;
 
        if (fstat(fd, &file->buf) == 0) {
 #ifdef S_IWOTH
@@ -382,7 +380,6 @@ static bool cf_file_check(CONF_SECTION *cs, char const *filename, bool check_per
 
        file->filename = filename;
        file->cs = cs;
-       file->input = true;
 
        if (stat(filename, &file->buf) < 0) {
                ERROR("Unable to check file \"%s\": %s", filename, fr_syserror(errno));
@@ -444,11 +441,13 @@ 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) {
-               if (!file->input) {
-                       cb->rcode |= CF_FILE_CONFIG;
-               } else {
-                       (void) cb->callback(cb->modules, file->cs);
+
+               if (cb->callback(cb->modules, file->cs)) {
                        cb->rcode |= CF_FILE_MODULE;
+                       DEBUG3("HUP: Changed module file %s", file->filename);
+               } else {
+                       DEBUG3("HUP: Changed config file %s", file->filename);
+                       cb->rcode |= CF_FILE_CONFIG;
                }
        }
 
index 8f22d37b536473216d3f6e75caee985d7b87cbed..43bc2b1365c1ffd804f5e49809685062603f59ec 100644 (file)
@@ -1125,7 +1125,7 @@ static int hup_callback(void *ctx, void *data)
 
        if (!module_hup_module(mi->cs, mi, time(NULL))) return 0;
 
-       return 0;
+       return 1;
 }
 
 void main_config_hup(void)