diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-07-29 20:31:07 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-07-29 20:31:07 +0200 |
commit | dacd6cee76a08331b8c8616c5f30f70ee49aa2f9 (patch) | |
tree | 7a7d73f2ac1f909255361781ca923365b6c9b7c3 /src/boot/bootctl.c | |
parent | 8388607b5851574e50a6e65db98135b793b08910 (diff) |
tree-wide: port everything over to fflush_and_check()
Some places invoked fflush() directly with their own manual error
checking, let's unify all that by using fflush_and_check().
This also unifies the general error paths of fflush()+rename() file
writers.
Diffstat (limited to 'src/boot/bootctl.c')
-rw-r--r-- | src/boot/bootctl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index 091ea375d3..359fde9998 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -489,9 +489,9 @@ static int copy_file(const char *from, const char *to, bool force) { } } while (!feof(f)); - fflush(g); - if (ferror(g)) { - r = log_error_errno(EIO, "Failed to write \"%s\": %m", to); + r = fflush_and_check(g); + if (r < 0) { + log_error_errno(r, "Failed to write \"%s\": %m", to); goto error; } @@ -519,7 +519,7 @@ static int copy_file(const char *from, const char *to, bool force) { return 0; error: - unlink(p); + (void) unlink(p); return r; } |