bus-message-util: introduce bus_message_dump_fd() and _string()
Then, use them in analyze and oomctl.
This commit is contained in:
+2
-8
@@ -6,7 +6,7 @@
|
||||
#include "build.h"
|
||||
#include "bus-error.h"
|
||||
#include "bus-locator.h"
|
||||
#include "copy.h"
|
||||
#include "bus-message-util.h"
|
||||
#include "main-func.h"
|
||||
#include "pretty-print.h"
|
||||
#include "terminal-util.h"
|
||||
@@ -47,7 +47,6 @@ static int dump_state(int argc, char *argv[], void *userdata) {
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
|
||||
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
|
||||
int fd = -EBADF;
|
||||
int r;
|
||||
|
||||
r = sd_bus_open_system(&bus);
|
||||
@@ -60,12 +59,7 @@ static int dump_state(int argc, char *argv[], void *userdata) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to dump context: %s", bus_error_message(&error, r));
|
||||
|
||||
r = sd_bus_message_read(reply, "h", &fd);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
fflush(stdout);
|
||||
return copy_bytes(fd, STDOUT_FILENO, UINT64_MAX, 0);
|
||||
return bus_message_dump_fd(reply);
|
||||
}
|
||||
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
|
||||
Reference in New Issue
Block a user