diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-24 07:06:39 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-24 07:06:39 +0000 |
| commit | e7ede0c75570ddd57b9d55e33764c3bdd74274b1 (patch) | |
| tree | ba484c1ad22bf6c3e531b9a7f4966cd16a6075c6 /util/libreboot-utils/lib/file.c | |
| parent | 616099edade1d43893564177cbd31ff5f1c7eea0 (diff) | |
mkhtemp: unified non-error close handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib/file.c')
| -rw-r--r-- | util/libreboot-utils/lib/file.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/util/libreboot-utils/lib/file.c b/util/libreboot-utils/lib/file.c index ea2bcd0b..00cab2e9 100644 --- a/util/libreboot-utils/lib/file.c +++ b/util/libreboot-utils/lib/file.c @@ -732,6 +732,22 @@ try_err(int loop_err, int errval) return -1; } +void +close_no_err(int *fd) +{ + int saved_errno = errno; + + if (fd == NULL) + return; + if (*fd < 0) + return; + + (void) close_on_eintr(*fd); + *fd = -1; + + errno = saved_errno; +} + int close_on_eintr(int fd) { @@ -1134,3 +1150,14 @@ retry: return rval; } + + + + + + + + + + + |
