valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0154-test-bus-marshal-use-cescaping-instead-of-hexmem.patch

4bff0a
From 4c6c21669483a38cf2a387784a3881b3a47139a3 Mon Sep 17 00:00:00 2001
4bff0a
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
4bff0a
Date: Sat, 7 Jul 2018 19:08:52 +0200
4bff0a
Subject: [PATCH] test-bus-marshal: use cescaping instead of hexmem
4bff0a
4bff0a
It is easier to see the contents this way by eye.
4bff0a
4bff0a
(cherry picked from commit 3ddf3d439463ab2c76391a4d22b54166be2dbe94)
4bff0a
4bff0a
Resolves: #1696224
4bff0a
---
4bff0a
 src/libsystemd/sd-bus/test-bus-marshal.c | 8 +++-----
4bff0a
 1 file changed, 3 insertions(+), 5 deletions(-)
4bff0a
4bff0a
diff --git a/src/libsystemd/sd-bus/test-bus-marshal.c b/src/libsystemd/sd-bus/test-bus-marshal.c
4bff0a
index c647f0ff12..f007168ca6 100644
4bff0a
--- a/src/libsystemd/sd-bus/test-bus-marshal.c
4bff0a
+++ b/src/libsystemd/sd-bus/test-bus-marshal.c
4bff0a
@@ -20,8 +20,8 @@
4bff0a
 #include "bus-label.h"
4bff0a
 #include "bus-message.h"
4bff0a
 #include "bus-util.h"
4bff0a
+#include "escape.h"
4bff0a
 #include "fd-util.h"
4bff0a
-#include "hexdecoct.h"
4bff0a
 #include "log.h"
4bff0a
 #include "util.h"
4bff0a
 
4bff0a
@@ -112,7 +112,7 @@ int main(int argc, char *argv[]) {
4bff0a
         uint8_t u, v;
4bff0a
         void *buffer = NULL;
4bff0a
         size_t sz;
4bff0a
-        char *h;
4bff0a
+        _cleanup_free_ char *h = NULL;
4bff0a
         const int32_t integer_array[] = { -1, -2, 0, 1, 2 }, *return_array;
4bff0a
         char *s;
4bff0a
         _cleanup_free_ char *first = NULL, *second = NULL, *third = NULL;
4bff0a
@@ -194,11 +194,9 @@ int main(int argc, char *argv[]) {
4bff0a
         r = bus_message_get_blob(m, &buffer, &sz);
4bff0a
         assert_se(r >= 0);
4bff0a
 
4bff0a
-        h = hexmem(buffer, sz);
4bff0a
+        h = cescape_length(buffer, sz);
4bff0a
         assert_se(h);
4bff0a
-
4bff0a
         log_info("message size = %zu, contents =\n%s", sz, h);
4bff0a
-        free(h);
4bff0a
 
4bff0a
 #if HAVE_GLIB
4bff0a
 #ifndef __SANITIZE_ADDRESS__