diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-28 09:03:18 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-28 09:03:18 +0000 |
| commit | 6643d9c1fa4d62e648d93ffc2841465d6422da22 (patch) | |
| tree | 197ca3e8add5b89609618d9938b0fc4cfe2f4ab5 /util/libreboot-utils/lib/io.c | |
| parent | 4ecdadb7a601b0613e65bf8547d17b39ed87153f (diff) | |
lbutils: unify xopen and open_on_eintr
use open_on_eintr for gbe files
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib/io.c')
| -rw-r--r-- | util/libreboot-utils/lib/io.c | 12 |
1 files changed, 9 insertions, 3 deletions
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 |
