chiark / gitweb /
Fix service file to match installed elogind binary location
[elogind.git] / src / shared / bus-util.c
index 9efcc6b762bf2ae5bf1b5b3cb50f50e594be566f..485bd0885a2492b3c5bfe0cbbdf91531b6ba87e8 100644 (file)
@@ -43,6 +43,7 @@
 #include "escape.h"
 #include "fd-util.h"
 #include "missing.h"
+#include "nsflags.h"
 #include "parse-util.h"
 #include "proc-cmdline.h"
 //#include "rlimit-util.h"
@@ -728,13 +729,12 @@ int bus_print_property(const char *name, sd_bus_message *property, bool value, b
                         return r;
 
                 if (all || !isempty(s)) {
-                        _cleanup_free_ char *escaped = NULL;
+                        bool good;
 
-                        escaped = xescape(s, "\n");
-                        if (!escaped)
-                                return -ENOMEM;
-
-                        print_property(name, "%s", escaped);
+                        /* This property has a single value, so we need to take
+                         * care not to print a new line, everything else is OK. */
+                        good = !strchr(s, '\n');
+                        print_property(name, "%s", good ? s : "[unprintable]");
                 }
 
                 return 1;
@@ -855,16 +855,16 @@ int bus_print_property(const char *name, sd_bus_message *property, bool value, b
                                 return r;
 
                         while ((r = sd_bus_message_read_basic(property, SD_BUS_TYPE_STRING, &str)) > 0) {
-                                _cleanup_free_ char *escaped = NULL;
+                                bool good;
 
                                 if (first && !value)
                                         printf("%s=", name);
 
-                                escaped = xescape(str, "\n ");
-                                if (!escaped)
-                                        return -ENOMEM;
+                                /* This property has multiple space-seperated values, so
+                                 * neither spaces not newlines can be allowed in a value. */
+                                good = str[strcspn(str, " \n")] == '\0';
 
-                                printf("%s%s", first ? "" : " ", escaped);
+                                printf("%s%s", first ? "" : " ", good ? str : "[unprintable]");
 
                                 first = false;
                         }
@@ -1600,7 +1600,6 @@ int bus_property_get_rlimit(
 
         return sd_bus_message_append(reply, "t", u);
 }
-#endif // 0
 
 int bus_track_add_name_many(sd_bus_track *t, char **l) {
         int r = 0;
@@ -1620,3 +1619,4 @@ int bus_track_add_name_many(sd_bus_track *t, char **l) {
 
         return r;
 }
+#endif // 0