From 4ecdadb7a601b0613e65bf8547d17b39ed87153f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 28 Mar 2026 08:32:27 +0000 Subject: libreboot-utils: unified errno handling on returns Signed-off-by: Leah Rowe --- util/libreboot-utils/lib/io.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'util/libreboot-utils/lib/io.c') diff --git a/util/libreboot-utils/lib/io.c b/util/libreboot-utils/lib/io.c index f69954c8..d3f5733d 100644 --- a/util/libreboot-utils/lib/io.c +++ b/util/libreboot-utils/lib/io.c @@ -439,10 +439,8 @@ gbe_mv(void) tmp_gbe_bin_exists = 0; ret_gbe_mv: - if (f->gbe_fd > -1) { close_on_eintr(&f->gbe_fd); - f->gbe_fd = -1; if (fsync_dir(f->fname) < 0) { f->io_err_gbe_bin = 1; @@ -462,17 +460,12 @@ ret_gbe_mv: tmp_gbe_bin_exists = 0; } - if (rval < 0) { - /* if nothing set errno, - * we assume EIO, or we - * use what was set - */ - if (errno == saved_errno) - errno = EIO; - } else { - errno = saved_errno; - } + if (rval >= 0) + goto out; + return set_errno(saved_errno, EIO); +out: + errno = saved_errno; return rval; } -- cgit v1.2.1