diff mbox series

[2/2] bootloader handler: fix paths and use TRACE / ERROR macros

Message ID 1515775206-9174-2-git-send-email-sbabic@denx.de
State Changes Requested
Headers show
Series [1/2] Allow again bootloader scripts | expand

Commit Message

Stefano Babic Jan. 12, 2018, 4:40 p.m. UTC
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 handlers/boot_handler.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/handlers/boot_handler.c b/handlers/boot_handler.c
index 8cda3f6..68c65b4 100644
--- a/handlers/boot_handler.c
+++ b/handlers/boot_handler.c
@@ -43,30 +43,24 @@  static int install_boot_environment(struct img_type *img,
 	char filename[64];
 	struct stat statbuf;
 
-	const char* TMPDIR = get_tmpdir();
-	if (snprintf(filename, sizeof(filename), "%s%s", TMPDIR,
+	if (snprintf(filename, sizeof(filename), "%s%s", get_tmpdirscripts(),
 		     img->fname) >= (int)sizeof(filename)) {
-		ERROR("Path too long: %s%s", TMPDIR, img->fname);
+		ERROR("Path too long: %s%s", get_tmpdirscripts(),
+			 img->fname);
 		return -1;
 	}
 	ret = stat(filename, &statbuf);
 	if (ret) {
 		fdout = openfileoutput(filename);
-		/*
-		 * Bootloader environment is set inside sw-description
-		 * there is no hash but sw-description was already verified
-		 */
 		ret = copyimage(&fdout, img, NULL);
 		close(fdout);
 	}
 
 	ret = bootloader_apply_list(filename);
-	if (ret < 0) {
-		notify(RUN, RECOVERY_NO_ERROR, ERRORLEVEL,
-		       "Error setting bootloader environment");
+	if (ret != 0) {
+		ERROR("Error setting bootloader environment");
 	} else {
-		notify(RUN, RECOVERY_NO_ERROR, INFOLEVEL,
-		       "Bootloader environment updated");
+		TRACE("Bootloader environment from %s updated", img->fname);
 	}
 
 	return ret;