summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-04-01 19:22:10 +0100
committerLeah Rowe <leah@libreboot.org>2026-04-01 20:17:26 +0100
commit6b67e124286c078afa83c05391b29a8ae672d85d (patch)
treeb5b7f364f18fbf2fd97cac69bb9a2c9abba080b8 /util/libreboot-utils/lib
parenta6d2de4e888b42e6fad53240d97b6cc2f06bf79f (diff)
lbutils/file: don't eintr loop fcntl
not indicated. the way we use it is basically like stat, to check that a file exists / is a file. just err the fuck out nuance: SETLK is non-blocking (no wait). we should loop on SETLKW, but we don't use that. in this codebase, we use SETLK for locking a tmpfile, but because of race conditions and wanting to make another file quickly, we just try again with a newly generated name, with a certain number of retries, so we justt use SETLK Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib')
-rw-r--r--util/libreboot-utils/lib/io.c4
-rw-r--r--util/libreboot-utils/lib/mkhtemp.c8
2 files changed, 3 insertions, 9 deletions
diff --git a/util/libreboot-utils/lib/io.c b/util/libreboot-utils/lib/io.c
index 5a1b121d..6bfbbf51 100644
--- a/util/libreboot-utils/lib/io.c
+++ b/util/libreboot-utils/lib/io.c
@@ -48,9 +48,7 @@ open_gbe_file(void)
if (f->gbe_st.st_nlink == 0)
exitf("%s: file unlinked while open", f->fname);
- while (fs_retry(saved_errno,
- _flags = fcntl(f->gbe_fd, F_GETFL)));
- if (_flags == -1)
+ if ((_flags = fcntl(f->gbe_fd, F_GETFL)) == -1)
exitf("%s: fcntl(F_GETFL)", f->fname);
/* O_APPEND allows POSIX write() to ignore
diff --git a/util/libreboot-utils/lib/mkhtemp.c b/util/libreboot-utils/lib/mkhtemp.c
index 8591e817..bb714b82 100644
--- a/util/libreboot-utils/lib/mkhtemp.c
+++ b/util/libreboot-utils/lib/mkhtemp.c
@@ -752,9 +752,7 @@ int secure_file(int *fd,
if_err(*fd < 0, EBADF))
goto err_demons;
- while (fs_retry(saved_errno,
- flags = fcntl(*fd, F_GETFL)));
- if (flags == -1)
+ if ((flags = fcntl(*fd, F_GETFL)) == -1)
goto err_demons;
if (if_err(bad_flags > 0 && (flags & bad_flags), EPERM))
@@ -899,9 +897,7 @@ lock_file(int fd, int flags)
fl.l_whence = SEEK_SET;
- while (fs_retry(saved_errno,
- fcntl_rval = fcntl(fd, F_SETLK, &fl)));
- if (fcntl_rval == -1)
+ if ((fcntl_rval = fcntl(fd, F_SETLK, &fl)) == -1)
goto err_lock_file;
reset_caller_errno(0);