From f08072a865fcf6191d65e7c01e11b99049758c57 Mon Sep 17 00:00:00 2001 From: zhongtao Date: Tue, 21 Nov 2023 03:27:31 +0000 Subject: [PATCH 23/64] !2260 bugfix for rebuild config * bugfix for rebuild config --- src/daemon/modules/container/restore/restore.c | 1 - src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c | 5 +---- src/daemon/modules/runtime/runtime.c | 5 +---- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/daemon/modules/container/restore/restore.c b/src/daemon/modules/container/restore/restore.c index f6218fe6..a60b1410 100644 --- a/src/daemon/modules/container/restore/restore.c +++ b/src/daemon/modules/container/restore/restore.c @@ -24,7 +24,6 @@ #include #include #include -#include #include "isulad_config.h" 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 2f42909b..8f7211d7 100644 --- a/src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c +++ b/src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c @@ -782,7 +782,6 @@ int rt_lcr_rebuild_config(const char *name, const char *runtime, const rt_rebuil char oci_config_file[PATH_MAX] = { 0 }; struct engine_operation *engine_ops = NULL; oci_runtime_spec *oci_spec = NULL; - __isula_auto_free char *json_container = NULL; __isula_auto_free parser_error err = NULL; engine_ops = engines_get_handler(runtime); @@ -836,9 +835,7 @@ 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 = 0; - + ret = nret != 0 ? -1 : 0; out: if (engine_ops != NULL && engine_ops->engine_clear_errmsg_op != NULL) { engine_ops->engine_clear_errmsg_op(); diff --git a/src/daemon/modules/runtime/runtime.c b/src/daemon/modules/runtime/runtime.c index d9a332af..4a239f0a 100644 --- a/src/daemon/modules/runtime/runtime.c +++ b/src/daemon/modules/runtime/runtime.c @@ -470,7 +470,6 @@ out: int runtime_rebuild_config(const char *name, const char *runtime, const rt_rebuild_config_params_t *params) { - int ret = 0; const struct rt_ops *ops = NULL; if (name == NULL || runtime == NULL || params == NULL) { @@ -484,9 +483,7 @@ int runtime_rebuild_config(const char *name, const char *runtime, const rt_rebui return -1; } - ret = ops->rt_rebuild_config(name, runtime, params); - - return ret; + return ops->rt_rebuild_config(name, runtime, params); } int runtime_resize(const char *name, const char *runtime, const rt_resize_params_t *params) -- 2.42.0