]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: use strextend_with_separator()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 20 May 2021 05:58:12 +0000 (14:58 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 20 May 2021 12:57:09 +0000 (21:57 +0900)
src/systemctl/systemctl-show.c

index a45f5fa363a58e8017aa2f426b2c25717f787db5..3686ac3c768a54192ca8bec039cb5185a0d2fa28 100644 (file)
@@ -1659,14 +1659,9 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
                                 if (r < 0)
                                         return r;
 
-                                while ((r = sd_bus_message_read(m, "(ss)", &partition, &mount_options)) > 0) {
-                                        _cleanup_free_ char *previous = NULL;
-
-                                        previous = TAKE_PTR(str);
-                                        str = strjoin(strempty(previous), previous ? ":" : "", partition, ":", mount_options);
-                                        if (!str)
+                                while ((r = sd_bus_message_read(m, "(ss)", &partition, &mount_options)) > 0)
+                                        if (!strextend_with_separator(&str, ":", partition, ":", mount_options))
                                                 return log_oom();
-                                }
                                 if (r < 0)
                                         return r;