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/mkhtemp.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'util/libreboot-utils/lib/mkhtemp.c') diff --git a/util/libreboot-utils/lib/mkhtemp.c b/util/libreboot-utils/lib/mkhtemp.c index 2726cb02..b5b9aeeb 100644 --- a/util/libreboot-utils/lib/mkhtemp.c +++ b/util/libreboot-utils/lib/mkhtemp.c @@ -295,11 +295,7 @@ tmpdir_policy(const char *path, return 0; err_tmpdir_policy: - - if (errno == saved_errno) - errno = EIO; - - return -1; + return set_errno(saved_errno, EIO); } int @@ -377,10 +373,7 @@ err_same_dir: close_on_eintr(&fd_a); close_on_eintr(&fd_b); - if (errno == saved_errno) - errno = EIO; - - return -1; + return set_errno(saved_errno, EIO); } /* bypass_all_sticky_checks: if set, @@ -467,19 +460,15 @@ world_writeable_and_sticky( goto sticky_hell; /* heaven visa denied */ sticky_heaven: - close_on_eintr(&dirfd); errno = saved_errno; return 1; sticky_hell: - - if (errno == saved_errno) - errno = EPERM; - close_on_eintr(&dirfd); + (void) set_errno(saved_errno, EPERM); return 0; } @@ -923,11 +912,7 @@ int secure_file(int *fd, return 0; err_demons: - - if (errno == saved_errno) - errno = EIO; - - return -1; + return set_errno(saved_errno, EIO); } int @@ -1037,9 +1022,5 @@ lock_file(int fd, int flags) return 0; err_lock_file: - - if (errno == saved_errno) - errno = EIO; - - return -1; + return set_errno(saved_errno, EIO); } -- cgit v1.2.1