From: Alan T. DeKok Date: Thu, 23 Jun 2016 21:00:00 +0000 (-0400) Subject: Correctly check for config / module HUP X-Git-Tag: release_3_0_12~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4492eaef2f5a2ed19c37c7fb45e78b6b3e92aef9;p=thirdparty%2Ffreeradius-server.git Correctly check for config / module HUP --- diff --git a/src/main/conffile.c b/src/main/conffile.c index c2047426427..611c3867ab5 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -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; } } diff --git a/src/main/mainconfig.c b/src/main/mainconfig.c index 8f22d37b536..43bc2b1365c 100644 --- a/src/main/mainconfig.c +++ b/src/main/mainconfig.c @@ -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)