From d2abde53033d58b6665becd75f854ad87aba33f6 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 31 Mar 2026 15:43:43 +0100 Subject: libreboot-utils: stricter errno handling where possible, try not to clobber sys errno. override it only when relatively safe. also: when a syscall succeeds, it may set errno. this is rare, but permitted (nothing specified against it in specs, and the specs say that errno is undefined on success). i'm not libc, but i'm wrapping around it, so i need to be careful in how i handle the errno value. also: i removed the requirement for directories to be executable, in mkhtemp.c, because this isn't required and will only break certain setups. in world_writeable and sticky, i made the checks stricter: the faccessat check was being skipped on some paths, so i've closed that loophole now. i also generally cleaned up some code, as part of the errno handling refactoring, where it made sense to do so, plus a few other bits of code cleanup. Signed-off-by: Leah Rowe --- util/libreboot-utils/mkhtemp.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'util/libreboot-utils/mkhtemp.c') diff --git a/util/libreboot-utils/mkhtemp.c b/util/libreboot-utils/mkhtemp.c index f7480ed6..65e637e9 100644 --- a/util/libreboot-utils/mkhtemp.c +++ b/util/libreboot-utils/mkhtemp.c @@ -1,11 +1,13 @@ -/* SPDX-License-Identifier: MIT - * Copyright (c) 2026 Leah Rowe - * +/* SPDX-License-Identifier: MIT ( >:3 ) + * Copyright (c) 2026 Leah Rowe /| |\ + * / \ * Hardened mktemp (mkhtemp!) * * WORK IN PROGRESS (proof of concept), or, v0.0000001 * DO NOT PUT THIS IN YOUR LINUX DISTRO YET. * + * In other words: for reference only -- PATCHES WELCOME! + * * I will remove this notice when the code is mature, and * probably contact several of your projects myself. * @@ -139,8 +141,4 @@ static void exit_cleanup(void) { return; -}/* - - ( >:3 ) - /| |\ - / \ */ +} -- cgit v1.2.1