chiark / gitweb /
importd: add new bus calls for importing local tar and raw images
[elogind.git] / src / libsystemd / sd-bus / bus-dump.c
index 8fba7ac6797c4955408f93e30acaa7c95521ea32..4bc896549a464eded5e0035baa5f3d94b34aff8c 100644 (file)
@@ -22,7 +22,6 @@
 #include "util.h"
 #include "capability.h"
 #include "strv.h"
-#include "audit.h"
 #include "macro.h"
 #include "cap-list.h"
 
@@ -129,8 +128,15 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
         if (r < 0)
                 return log_error_errno(r, "Failed to rewind: %m");
 
-        if (!(flags & BUS_MESSAGE_DUMP_SUBTREE_ONLY))
-                fprintf(f, "%sMESSAGE \"%s\" {\n", indent(0, flags), strempty(m->root_container.signature));
+        if (!(flags & BUS_MESSAGE_DUMP_SUBTREE_ONLY)) {
+                _cleanup_free_ char *prefix = NULL;
+
+                prefix = indent(0, flags);
+                if (!prefix)
+                        return log_oom();
+
+                fprintf(f, "%sMESSAGE \"%s\" {\n", prefix, strempty(m->root_container.signature));
+        }
 
         for (;;) {
                 _cleanup_free_ char *prefix = NULL;
@@ -259,8 +265,15 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
                 }
         }
 
-        if (!(flags & BUS_MESSAGE_DUMP_SUBTREE_ONLY))
-                fprintf(f, "%s};\n\n", indent(0, flags));
+        if (!(flags & BUS_MESSAGE_DUMP_SUBTREE_ONLY)) {
+                _cleanup_free_ char *prefix = NULL;
+
+                prefix = indent(0, flags);
+                if (!prefix)
+                        return log_oom();
+
+                fprintf(f, "%s};\n\n", prefix);
+        }
 
         return 0;
 }
@@ -340,7 +353,7 @@ int bus_creds_dump(sd_bus_creds *c, FILE *f, bool terse) {
                 color = ansi_highlight();
 
                 off = ansi_highlight_off();
-                suffix = strappenda(off, "\n");
+                suffix = strjoina(off, "\n");
         }
 
         if (c->mask & SD_BUS_CREDS_PID)