summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-07-29 20:31:07 +0200
committerLennart Poettering <lennart@poettering.net>2015-07-29 20:31:07 +0200
commitdacd6cee76a08331b8c8616c5f30f70ee49aa2f9 (patch)
tree7a7d73f2ac1f909255361781ca923365b6c9b7c3 /src/core/manager.c
parent8388607b5851574e50a6e65db98135b793b08910 (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/core/manager.c')
-rw-r--r--src/core/manager.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index a1f37bbbb3..ba107d4615 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1701,6 +1701,7 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
ssize_t n;
struct signalfd_siginfo sfsi;
bool sigchld = false;
+ int r;
assert(m);
assert(m->signal_fd == fd);
@@ -1809,20 +1810,16 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
f = open_memstream(&dump, &size);
if (!f) {
- log_warning("Failed to allocate memory stream.");
+ log_warning_errno(errno, "Failed to allocate memory stream: %m");
break;
}
manager_dump_units(m, f, "\t");
manager_dump_jobs(m, f, "\t");
- if (ferror(f)) {
- log_warning("Failed to write status stream");
- break;
- }
-
- if (fflush(f)) {
- log_warning("Failed to flush status stream");
+ r = fflush_and_check(f);
+ if (r < 0) {
+ log_warning_errno(r, "Failed to write status stream: %m");
break;
}