diff mbox series

[1/1] webserver: fix postupdate default when not using a config file

Message ID 1547280922-22728-1-git-send-email-james.hilliard1@gmail.com
State Accepted
Headers show
Series [1/1] webserver: fix postupdate default when not using a config file | expand

Commit Message

James Hilliard Jan. 12, 2019, 8:15 a.m. UTC
From: James Hilliard <james.hilliard1@gmail.com>

We can't set the postupdate default in the mongoose_settings function
since mongoose_settings is only run when a config file is present,
instead we set it in start_mongoose before mongoose_settings is run.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 mongoose/mongoose_interface.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Stefano Babic Jan. 13, 2019, 11:59 a.m. UTC | #1
Hi James,

On 12/01/19 09:15, james.hilliard1@gmail.com wrote:
> From: James Hilliard <james.hilliard1@gmail.com>
> 
> We can't set the postupdate default in the mongoose_settings function
> since mongoose_settings is only run when a config file is present,
> instead we set it in start_mongoose before mongoose_settings is run.
> 
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>  mongoose/mongoose_interface.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c
> index ef48c00..2ef3f6d 100644
> --- a/mongoose/mongoose_interface.c
> +++ b/mongoose/mongoose_interface.c
> @@ -492,10 +492,6 @@ static int mongoose_settings(void *elem, void  __attribute__ ((__unused__)) *dat
>  	if (strlen(tmp)) {
>  		opts->auth_domain = strdup(tmp);
>  	}
> -	/*
> -	 * Default value is active
> -	 */
> -	run_postupdate = true;
>  	get_field(LIBCFG_PARSER, elem, "run-postupdate", &run_postupdate);
>  
>  	return 0;
> @@ -556,6 +552,11 @@ int start_mongoose(const char *cfgfname, int argc, char *argv[])
>  	/* No listing directory as default */
>  	opts.listing = false;
>  
> +	/*
> +	 * Default value is active
> +	 */
> +	run_postupdate = true;
> +
>  	if (cfgfname) {
>  		read_module_settings(cfgfname, "webserver", mongoose_settings, &opts);
>  	}
> 

Acked-by: stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c
index ef48c00..2ef3f6d 100644
--- a/mongoose/mongoose_interface.c
+++ b/mongoose/mongoose_interface.c
@@ -492,10 +492,6 @@  static int mongoose_settings(void *elem, void  __attribute__ ((__unused__)) *dat
 	if (strlen(tmp)) {
 		opts->auth_domain = strdup(tmp);
 	}
-	/*
-	 * Default value is active
-	 */
-	run_postupdate = true;
 	get_field(LIBCFG_PARSER, elem, "run-postupdate", &run_postupdate);
 
 	return 0;
@@ -556,6 +552,11 @@  int start_mongoose(const char *cfgfname, int argc, char *argv[])
 	/* No listing directory as default */
 	opts.listing = false;
 
+	/*
+	 * Default value is active
+	 */
+	run_postupdate = true;
+
 	if (cfgfname) {
 		read_module_settings(cfgfname, "webserver", mongoose_settings, &opts);
 	}