]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
erasure-code/lrc: early return if to_string() fails
authorKefu Chai <kchai@redhat.com>
Tue, 17 Aug 2021 00:43:46 +0000 (08:43 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 17 Aug 2021 00:47:33 +0000 (08:47 +0800)
so far to_string() always return 0, but it is designed to return
an error code if it fails to parse a string.

this change silences following warning:

../src/erasure-code/lrc/ErasureCodeLrc.cc:399:7: error: variable 'err' set but not used [-Werror,-Wunused-but-set-variable]
  int err = 0;
      ^

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/erasure-code/lrc/ErasureCodeLrc.cc

index f66b0fc4669d79c71678274f3d785625d0c4e6ca..bea861f1adee50b18d744ac0c8dfcb2f0b7ba89f 100644 (file)
@@ -403,7 +403,9 @@ int ErasureCodeLrc::parse_rule(ErasureCodeProfile &profile,
   err |= to_string("crush-device-class", profile,
                   &rule_device_class,
                   "", ss);
-
+  if (err) {
+    return err;
+  }
   if (profile.count("crush-steps") != 0) {
     rule_steps.clear();
     string str = profile.find("crush-steps")->second;