diff options
Diffstat (limited to 'util/libreboot-utils/lib/io.c')
| -rw-r--r-- | util/libreboot-utils/lib/io.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/util/libreboot-utils/lib/io.c b/util/libreboot-utils/lib/io.c index 4938cdc8..9bbf1f30 100644 --- a/util/libreboot-utils/lib/io.c +++ b/util/libreboot-utils/lib/io.c @@ -33,7 +33,7 @@ open_gbe_file(void) f->gbe_fd = -1; - open_on_eintr(f->fname, &f->gbe_fd, + open_file_on_eintr(f->fname, &f->gbe_fd, O_NOFOLLOW | O_CLOEXEC | O_NOCTTY, ((cmd->flags & O_ACCMODE) == O_RDONLY) ? 0400 : 0600, &f->gbe_st); @@ -104,8 +104,7 @@ read_file(void) /* read main file */ _r = rw_file_exact(f->gbe_fd, f->buf, f->gbe_file_size, - 0, IO_PREAD, NO_LOOP_EAGAIN, LOOP_EINTR, - MAX_ZERO_RW_RETRY, OFF_ERR); + 0, IO_PREAD, MAX_ZERO_RW_RETRY, OFF_ERR); if (_r < 0) err_exit(errno, "%s: read failed", f->fname); @@ -113,8 +112,7 @@ read_file(void) /* copy to tmpfile */ _r = rw_file_exact(f->tmp_fd, f->buf, f->gbe_file_size, - 0, IO_PWRITE, NO_LOOP_EAGAIN, LOOP_EINTR, - MAX_ZERO_RW_RETRY, OFF_ERR); + 0, IO_PWRITE, MAX_ZERO_RW_RETRY, OFF_ERR); if (_r < 0) err_exit(errno, "%s: %s: copy failed", @@ -137,8 +135,7 @@ read_file(void) err_exit(errno, "%s: fsync (tmpfile copy)", f->tname); _r = rw_file_exact(f->tmp_fd, f->bufcmp, f->gbe_file_size, - 0, IO_PREAD, NO_LOOP_EAGAIN, LOOP_EINTR, - MAX_ZERO_RW_RETRY, OFF_ERR); + 0, IO_PREAD, MAX_ZERO_RW_RETRY, OFF_ERR); if (_r < 0) err_exit(errno, "%s: read failed (cmp)", f->tname); @@ -473,9 +470,9 @@ ret_gbe_mv: if (rval >= 0) goto out; - return set_errno(saved_errno, EIO); + return with_fallback_errno(EIO); out: - errno = saved_errno; + reset_caller_errno(rval); return rval; } @@ -570,12 +567,10 @@ rw_gbe_file_exact(int fd, unsigned char *mem, size_t nrw, goto err_rw_gbe_file_exact; r = rw_file_exact(fd, mem, nrw, off, rw_type, - NO_LOOP_EAGAIN, LOOP_EINTR, MAX_ZERO_RW_RETRY, - OFF_ERR); + MAX_ZERO_RW_RETRY, OFF_ERR); return rw_over_nrw(r, nrw); err_rw_gbe_file_exact: - errno = EIO; - return -1; + return with_fallback_errno(EIO); } |
