34 lines
1.1 KiB
Diff
34 lines
1.1 KiB
Diff
From: Anatolij Gustschin <agust@denx.de>
|
|
Date: Fri, 29 Apr 2016 22:00:11 +0200
|
|
Subject: [PATCH] tools: env: fix config file loading in env library
|
|
|
|
env library is broken as the config file pointer is only initialized
|
|
in main(). When running in the env library parse_config() fails:
|
|
|
|
Cannot parse config file '(null)': Bad address
|
|
|
|
Ensure that config file pointer is always initialized.
|
|
|
|
Signed-off-by: Anatolij Gustschin <agust@denx.de>
|
|
Cc: Stefano Babic <sbabic@denx.de>
|
|
(cherry picked from commit 925c97c248527391de32c2926f7e1911850fd4b0)
|
|
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
|
|
---
|
|
tools/env/fw_env.c | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
|
|
index 2533dc4eec2b..b2f62827d918 100644
|
|
--- a/tools/env/fw_env.c
|
|
+++ b/tools/env/fw_env.c
|
|
@@ -1326,6 +1326,9 @@ static int parse_config ()
|
|
struct stat st;
|
|
|
|
#if defined(CONFIG_FILE)
|
|
+ if (!common_args.config_file)
|
|
+ common_args.config_file = CONFIG_FILE;
|
|
+
|
|
/* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */
|
|
if (get_config(common_args.config_file)) {
|
|
fprintf(stderr, "Cannot parse config file '%s': %m\n",
|