From dacd6cee76a08331b8c8616c5f30f70ee49aa2f9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 29 Jul 2015 20:31:07 +0200 Subject: 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. --- src/network/networkd-link.c | 5 ++--- src/network/networkd-manager.c | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/network') diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index f20f68b482..9d570e0146 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -2388,14 +2388,13 @@ int link_save(Link *link) { } return 0; + fail: - log_link_error_errno(link, r, "Failed to save link data to %s: %m", link->state_file); (void) unlink(link->state_file); - if (temp_path) (void) unlink(temp_path); - return r; + return log_link_error_errno(link, r, "Failed to save link data to %s: %m", link->state_file); } static const char* const link_state_table[_LINK_STATE_MAX] = { diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index a5c2351cf9..e718c4840a 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -818,10 +818,10 @@ int manager_save(Manager *m) { return 0; fail: - log_error_errno(r, "Failed to save network state to %s: %m", m->state_file); - unlink(m->state_file); - unlink(temp_path); - return r; + (void) unlink(m->state_file); + (void) unlink(temp_path); + + return log_error_errno(r, "Failed to save network state to %s: %m", m->state_file); } int manager_address_pool_acquire(Manager *m, int family, unsigned prefixlen, union in_addr_union *found) { -- cgit v1.2.3-54-g00ecf