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.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/util/libreboot-utils/lib/io.c b/util/libreboot-utils/lib/io.c
index 94bde87e..cc38e5c7 100644
--- a/util/libreboot-utils/lib/io.c
+++ b/util/libreboot-utils/lib/io.c
@@ -239,21 +239,8 @@ write_to_gbe_bin(void)
saved_errno = errno;
- if (close_on_eintr(f->tmp_fd) == -1) {
- f->tmp_fd = -1;
-
- fprintf(stderr, "FAIL: %s: close\n", f->tname);
- f->io_err_gbe_bin = 1;
- }
- f->tmp_fd = -1;
-
- if (close_on_eintr(f->gbe_fd) == -1) {
- f->gbe_fd = -1;
-
- fprintf(stderr, "FAIL: %s: close\n", f->fname);
- f->io_err_gbe_bin = 1;
- }
- f->gbe_fd = -1;
+ f->io_err_gbe_bin |= -close_warn(&f->tmp_fd, f->tname);
+ f->io_err_gbe_bin |= -close_warn(&f->gbe_fd, f->fname);
errno = saved_errno;
@@ -279,13 +266,7 @@ write_to_gbe_bin(void)
/* removed by rename
*/
-
- if (f->tname != NULL) {
- free(f->tname);
- f->tname = NULL;
- }
-
- f->tname = NULL;
+ free_if_null(&f->tname);
}
}
@@ -513,12 +494,7 @@ gbe_mv(void)
goto ret_gbe_mv;
}
- if (dest_tmp != NULL) {
- free(dest_tmp);
- dest_tmp = NULL;
- }
-
- dest_tmp = NULL;
+ free_if_null(&dest_tmp);
ret_gbe_mv: