From 262a827ab4d07d32351f5b3288a6939fe0ddf3f1 Mon Sep 17 00:00:00 2001 From: Vasily Gorbik Date: Thu, 5 Apr 2018 16:51:48 +0200 Subject: [PATCH] chreipl: make write_str_errno return errno as the name suggests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make write_str_errno return errno in all error cases, so that it would be usable in scenarious where open call could fail and we just want to get an errno, not to exit. This function is currently only used by chshut in a context where such a change wouldn't hurt debug ability. 159 if (write_str_errno(argv[2], path)) 160 ERR_EXIT_ERRNO("Could not set \"%s\"", path); Reviewed-by: Heiko Carstens Signed-off-by: Vasily Gorbik Signed-off-by: Jan Höppner --- ipl_tools/system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipl_tools/system.c b/ipl_tools/system.c index 3ad1cb01..41121378 100644 --- a/ipl_tools/system.c +++ b/ipl_tools/system.c @@ -129,7 +129,7 @@ int write_str_errno(char *string, char *file) snprintf(path, sizeof(path), "/sys/firmware/%s", file); fh = open(path, O_WRONLY); if (fh < 0) - ERR_EXIT_ERRNO("Could not open \"%s\"", file); + return errno; if (write(fh, value, strlen(value)) < 0) return errno; close(fh);