summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/libreboot-utils/lib/io.c')
-rw-r--r--util/libreboot-utils/lib/io.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/util/libreboot-utils/lib/io.c b/util/libreboot-utils/lib/io.c
index f8e67977..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
@@ -108,16 +106,16 @@ read_file(void)
/* read main file
*/
- _r = rw_file_exact(f->gbe_fd, f->buf, f->gbe_file_size,
- 0, IO_PREAD, MAX_ZERO_RW_RETRY);
+ _r = rw_exact(f->gbe_fd, f->buf, f->gbe_file_size,
+ 0, IO_PREAD);
if (_r < 0)
exitf("%s: read failed", f->fname);
/* copy to tmpfile
*/
- _r = rw_file_exact(f->tmp_fd, f->buf, f->gbe_file_size,
- 0, IO_PWRITE, MAX_ZERO_RW_RETRY);
+ _r = rw_exact(f->tmp_fd, f->buf, f->gbe_file_size,
+ 0, IO_PWRITE);
if (_r < 0)
exitf("%s: %s: copy failed",
@@ -139,8 +137,8 @@ read_file(void)
if (fsync_on_eintr(f->tmp_fd) == -1)
exitf("%s: fsync (tmpfile copy)", f->tname);
- _r = rw_file_exact(f->tmp_fd, f->bufcmp, f->gbe_file_size,
- 0, IO_PREAD, MAX_ZERO_RW_RETRY);
+ _r = rw_exact(f->tmp_fd, f->bufcmp, f->gbe_file_size,
+ 0, IO_PREAD);
if (_r < 0)
exitf("%s: read failed (cmp)", f->tname);
@@ -251,8 +249,8 @@ write_to_gbe_bin(void)
saved_errno = errno;
- close_on_eintr(&f->tmp_fd);
- close_on_eintr(&f->gbe_fd);
+ xclose(&f->tmp_fd);
+ xclose(&f->gbe_fd);
errno = saved_errno;
@@ -437,7 +435,7 @@ gbe_mv(void)
tmp_gbe_bin_exists = 0;
if (f->gbe_fd > -1) {
- close_on_eintr(&f->gbe_fd);
+ xclose(&f->gbe_fd);
if (fsync_dir(f->fname) < 0) {
f->io_err_gbe_bin = 1;
@@ -445,7 +443,7 @@ gbe_mv(void)
}
}
- close_on_eintr(&f->tmp_fd);
+ xclose(&f->tmp_fd);
/* before this function is called,
* tmp_fd may have been moved
@@ -556,8 +554,7 @@ rw_gbe_file_exact(int fd, unsigned char *mem, size_t nrw,
if (nrw > (size_t)GBE_PART_SIZE)
goto err_rw_gbe_file_exact;
- r = rw_file_exact(fd, mem, nrw, off, rw_type,
- MAX_ZERO_RW_RETRY);
+ r = rw_exact(fd, mem, nrw, off, rw_type);
return rw_over_nrw(r, nrw);