summaryrefslogtreecommitdiff
path: root/0001-code-improve-for-sandbox.cc.patch
blob: f804203793cdb42ec2e8b92a00c59380fa7c0127 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From 9497e03709a035805effd96eaa21f6c221a79e94 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Fri, 19 Jan 2024 17:12:30 +0800
Subject: [PATCH 01/43] code improve for sandbox.cc

Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
 src/daemon/sandbox/sandbox.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/daemon/sandbox/sandbox.cc b/src/daemon/sandbox/sandbox.cc
index 359cfbad..7b6496ed 100644
--- a/src/daemon/sandbox/sandbox.cc
+++ b/src/daemon/sandbox/sandbox.cc
@@ -1086,8 +1086,7 @@ void Sandbox::FillSandboxMetadata(sandbox_metadata* metadata, Errors &error)
     metadata->task_address = util_strdup_s(m_taskAddress.c_str());
     metadata->net_ns_path = util_strdup_s(m_netNsPath.c_str());
 
-    google::protobuf::util::MessageToJsonString(*m_sandboxConfig.get(), &jsonStr);
-    if (jsonStr.length() == 0) {
+    if (!google::protobuf::util::MessageToJsonString(*m_sandboxConfig.get(), &jsonStr).ok()) {
         error.Errorf("Failed to get sandbox config json for sandbox: '%s'", m_id.c_str());
         ERROR("Failed to get sandbox config json for sandbox: '%s'", m_id.c_str());
     }
-- 
2.34.1