From: Kefu Chai Date: Tue, 17 Aug 2021 00:43:46 +0000 (+0800) Subject: erasure-code/lrc: early return if to_string() fails X-Git-Tag: v17.1.0~1100^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=621725ab4763d5c6e65bc6088b08929bfe632bfb;p=ceph.git erasure-code/lrc: early return if to_string() fails 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 --- diff --git a/src/erasure-code/lrc/ErasureCodeLrc.cc b/src/erasure-code/lrc/ErasureCodeLrc.cc index f66b0fc4669d..bea861f1adee 100644 --- a/src/erasure-code/lrc/ErasureCodeLrc.cc +++ b/src/erasure-code/lrc/ErasureCodeLrc.cc @@ -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;