From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Wed, 4 May 2016 15:25:00 +0200 Subject: [U-Boot] [PATCH] tools: env: fix config file loading in env library In-Reply-To: <1461960011-22469-1-git-send-email-agust@denx.de> References: <1461960011-22469-1-git-send-email-agust@denx.de> Message-ID: <5729F82C.1070401@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 29/04/2016 22:00, Anatolij Gustschin wrote: > 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 > Cc: Stefano Babic > --- > 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 1420ac5..06cf63d 100644 > --- a/tools/env/fw_env.c > +++ b/tools/env/fw_env.c > @@ -1325,6 +1325,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", > Reviewed-by : Stefano Babic Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================