]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/msg_types: fix entity_addrvec_t::parse() with null end arg
authorSage Weil <sage@redhat.com>
Tue, 27 Nov 2018 04:12:11 +0000 (22:12 -0600)
committerSage Weil <sage@redhat.com>
Fri, 21 Dec 2018 21:31:32 +0000 (15:31 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/msg/msg_types.cc
src/test/cli/monmaptool/add-many.t

index 8343bbadd9ee34b6af9368b6b029ac35ca1c06d9..9e1ecdbdf62abac291c05d6b09df6742a4d89ab1 100644 (file)
@@ -223,6 +223,10 @@ ostream& operator<<(ostream& out, const sockaddr *sa)
 
 bool entity_addrvec_t::parse(const char *s, const char **end)
 {
+  const char *static_end;
+  if (!end) {
+    end = &static_end;
+  }
   v.clear();
   while (*s) {
     entity_addr_t a;
index 92f4a9ee692b31d8cbfbdf3a14ccb3c4d718bde0..0ae4e71731b0d92013ff7d6f91542e8902765cb5 100644 (file)
@@ -14,7 +14,9 @@
   $ monmaptool --add baz 4.5.6.7:8901 mymonmap
   monmaptool: monmap file mymonmap
   monmaptool: writing epoch 0 to mymonmap (3 monitors)
-
+  $ monmaptool --addv fiz v2:172.21.15.68:6791,v1:172.21.15.68:6792 mymonmap
+  monmaptool: monmap file mymonmap
+  monmaptool: writing epoch 0 to mymonmap (4 monitors)
   $ monmaptool --print mymonmap
   monmaptool: monmap file mymonmap
   epoch 0
@@ -22,8 +24,9 @@
   last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
   created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
   0: v1:2.3.4.5:6789/0 mon.foo
-  1: v2:3.4.5.6:7890/0 mon.bar
-  2: v2:4.5.6.7:8901/0 mon.baz
+  1: [v2:172.21.15.68:6791/0,v1:172.21.15.68:6792/0] mon.fiz
+  2: v2:3.4.5.6:7890/0 mon.bar
+  3: v2:4.5.6.7:8901/0 mon.baz
 
   $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
   $ [ "$ORIG_FSID" = "$NEW_FSID" ]