diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/dbus-manager.c | 7 | ||||
-rw-r--r-- | src/core/manager.c | 13 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index d8b39bdf5f..5722e3c2bb 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -1069,10 +1069,9 @@ static int method_dump(sd_bus_message *message, void *userdata, sd_bus_error *er manager_dump_units(m, f, NULL); manager_dump_jobs(m, f, NULL); - fflush(f); - - if (ferror(f)) - return -ENOMEM; + r = fflush_and_check(f); + if (r < 0) + return r; return sd_bus_reply_method_return(message, "s", dump); } 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; } |