summaryrefslogtreecommitdiff
path: root/0033-2275-bugfix-for-rt_lcr_rebuild_config.patch
diff options
context:
space:
mode:
Diffstat (limited to '0033-2275-bugfix-for-rt_lcr_rebuild_config.patch')
-rw-r--r--0033-2275-bugfix-for-rt_lcr_rebuild_config.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/0033-2275-bugfix-for-rt_lcr_rebuild_config.patch b/0033-2275-bugfix-for-rt_lcr_rebuild_config.patch
new file mode 100644
index 0000000..ec42563
--- /dev/null
+++ b/0033-2275-bugfix-for-rt_lcr_rebuild_config.patch
@@ -0,0 +1,46 @@
+From fa7356538c7f747a81aa3d0a511a662ee4345afe Mon Sep 17 00:00:00 2001
+From: zhongtao <zhongtao17@huawei.com>
+Date: Fri, 24 Nov 2023 08:33:45 +0000
+Subject: [PATCH 33/64] !2275 bugfix for rt_lcr_rebuild_config * bugfix for
+ rt_lcr_rebuild_config
+
+---
+ src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c b/src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c
+index 8f7211d7..44ecab5a 100644
+--- a/src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c
++++ b/src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c
+@@ -777,6 +777,7 @@ int rt_lcr_rebuild_config(const char *name, const char *runtime, const rt_rebuil
+ {
+ int ret = -1;
+ int nret = 0;
++ bool rebuild_success = false;
+ char config_file[PATH_MAX] = { 0 };
+ char bak_config_file[PATH_MAX] = { 0 };
+ char oci_config_file[PATH_MAX] = { 0 };
+@@ -825,8 +826,8 @@ int rt_lcr_rebuild_config(const char *name, const char *runtime, const rt_rebuil
+ goto out;
+ }
+
+- nret = engine_ops->engine_create_op(name, params->rootpath, (void *)oci_spec);
+- if (nret != 0) {
++ rebuild_success = engine_ops->engine_create_op(name, params->rootpath, (void *)oci_spec);
++ if (!rebuild_success) {
+ // delete the invalid config file to prevent rename failed
+ if (util_fileself_exists(config_file) && util_path_remove(config_file) != 0) {
+ WARN("Failed to remove bak_config_file for container %s", name);
+@@ -835,7 +836,8 @@ int rt_lcr_rebuild_config(const char *name, const char *runtime, const rt_rebuil
+ WARN("Failed to rename backup old config to config for container %s", name);
+ }
+ }
+- ret = nret != 0 ? -1 : 0;
++ ret = rebuild_success ? 0 : -1;
++
+ out:
+ if (engine_ops != NULL && engine_ops->engine_clear_errmsg_op != NULL) {
+ engine_ops->engine_clear_errmsg_op();
+--
+2.42.0
+