From 6643d9c1fa4d62e648d93ffc2841465d6422da22 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 28 Mar 2026 09:03:18 +0000 Subject: lbutils: unify xopen and open_on_eintr use open_on_eintr for gbe files Signed-off-by: Leah Rowe --- util/libreboot-utils/lib/io.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 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 d3f5733d..a09e3992 100644 --- a/util/libreboot-utils/lib/io.c +++ b/util/libreboot-utils/lib/io.c @@ -27,9 +27,12 @@ open_gbe_file(void) int _flags; - xopen(&f->gbe_fd, f->fname, - cmd->flags | O_BINARY | - O_NOFOLLOW | O_CLOEXEC | O_NOCTTY, &f->gbe_st); + f->gbe_fd = -1; + + open_on_eintr(f->fname, &f->gbe_fd, + O_NOFOLLOW | O_CLOEXEC | O_NOCTTY, + ((cmd->flags & O_ACCMODE) == O_RDONLY) ? 0400 : 0600, + &f->gbe_st); if (f->gbe_st.st_nlink > 1) err_exit(EINVAL, @@ -62,8 +65,11 @@ open_gbe_file(void) err_exit(EINVAL, "File size must be 8KB, 16KB or 128KB"); } +/* currently fails (EBADF), locks are advisory anyway: */ +/* if (lock_file(f->gbe_fd, cmd->flags) == -1) err_exit(errno, "%s: can't lock", f->fname); +*/ } void -- cgit v1.2.1