portablectl: don't join strv if we don't want to display it
authorLennart Poettering <lennart@poettering.net>
Thu, 31 May 2018 10:05:53 +0000 (12:05 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 31 May 2018 10:05:53 +0000 (12:05 +0200)
src/portable/portablectl.c

index 2105715..5c56bce 100644 (file)
@@ -141,18 +141,20 @@ static int determine_matches(const char *image, char **l, bool allow_any, char *
                 if (!arg_quiet)
                         log_info("(Matching all unit files.)");
         } else {
-                _cleanup_free_ char *joined = NULL;
 
                 k = strv_copy(l);
                 if (!k)
                         return log_oom();
 
-                joined = strv_join(k, "', '");
-                if (!joined)
-                        return log_oom();
+                if (!arg_quiet) {
+                        _cleanup_free_ char *joined = NULL;
+
+                        joined = strv_join(k, "', '");
+                        if (!joined)
+                                return log_oom();
 
-                if (!arg_quiet)
                         log_info("(Matching unit files with prefixes '%s'.)", joined);
+                }
         }
 
         *ret = TAKE_PTR(k);