0001-tools-env-fix-config-file-loading-in-env-library.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. From 925c97c248527391de32c2926f7e1911850fd4b0 Mon Sep 17 00:00:00 2001
  2. From: Anatolij Gustschin <agust@denx.de>
  3. Date: Fri, 29 Apr 2016 22:00:11 +0200
  4. Subject: [PATCH] tools: env: fix config file loading in env library
  5. env library is broken as the config file pointer is only initialized
  6. in main(). When running in the env library parse_config() fails:
  7. Cannot parse config file '(null)': Bad address
  8. Ensure that config file pointer is always initialized.
  9. Signed-off-by: Anatolij Gustschin <agust@denx.de>
  10. Cc: Stefano Babic <sbabic@denx.de>
  11. ---
  12. tools/env/fw_env.c | 3 +++
  13. 1 file changed, 3 insertions(+)
  14. diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
  15. index 1420ac5..06cf63d 100644
  16. --- a/tools/env/fw_env.c
  17. +++ b/tools/env/fw_env.c
  18. @@ -1325,6 +1325,9 @@ static int parse_config ()
  19. struct stat st;
  20. #if defined(CONFIG_FILE)
  21. + if (!common_args.config_file)
  22. + common_args.config_file = CONFIG_FILE;
  23. +
  24. /* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */
  25. if (get_config(common_args.config_file)) {
  26. fprintf(stderr, "Cannot parse config file '%s': %m\n",
  27. --
  28. 2.5.5