From b775a42cf8e70cdfb1ea790b8645365cd63f7baa Mon Sep 17 00:00:00 2001 From: stivn <9699603+stivn@user.noreply.gitee.com> Date: Fri, 31 Dec 2021 09:09:05 +0000 Subject: [PATCH] fixed 32d6d6a from https://gitee.com/stivn/test_developertest/pulls/79 update examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp. Signed-off-by: stivn --- .../distributedtest/common/distribute_demo_agent.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp b/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp index 95dab2b..b58239e 100644 --- a/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp +++ b/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp @@ -186,8 +186,16 @@ int DistributeDemoAgent::AddTwoValue(const std::string &strArgs, int argsLen, co int val1 = 0; int val2 = 0; int val3 = 0; - sscanf_s(strArgs.c_str(), "%d %d", &val1, &val2); - sscanf_s(strExpectValue.c_str(), "%d", &val3); + ret1 = sscanf_s(strArgs.c_str(), "%d %d", &val1, &val2); + if (ret1 == -1) { + HiLog::Error(LABEL, "sccanf_s failed. ret1 == -1."); + return 0; + } + ret2 = sscanf_s(strExpectValue.c_str(), "%d", &val3); + if (ret2 == -1) { + HiLog::Error(LABEL, "sccanf_s failed. ret2 == -1."); + return 0; + } EXPECT_TRUE(val3 == (val1 + val2)); return val1 + val2; } -- Gitee