OSDN Git Service

Fix idmap2 policy concatenation
authorRyan Mitchell <rtmitchell@google.com>
Wed, 3 Apr 2019 18:02:39 +0000 (11:02 -0700)
committerRyan Mitchell <rtmitchell@google.com>
Wed, 3 Apr 2019 18:02:39 +0000 (11:02 -0700)
When printing warning messages while generating idmaps, put the vertical
bar chracater in between the policies.

Bug: none
Test: manual

Change-Id: I8efee753d9ed7ce99ccafd49b6c8744eea031839

cmds/idmap2/libidmap2/Idmap.cpp

index 6d5fe7b..49470b4 100644 (file)
@@ -269,12 +269,10 @@ Result<std::unique_ptr<const Idmap>> Idmap::FromBinaryStream(std::istream& strea
 std::string ConcatPolicies(const std::vector<std::string>& policies) {
   std::string message;
   for (const std::string& policy : policies) {
-    if (message.empty()) {
-      message.append(policy);
-    } else {
-      message.append(policy);
+    if (!message.empty()) {
       message.append("|");
     }
+    message.append(policy);
   }
 
   return message;