From 257054b234debb7b1fcafce6f2ec3df828370aed Mon Sep 17 00:00:00 2001 From: songbuhuang <544824346@qq.com> Date: Sun, 12 Feb 2023 15:23:37 +0800 Subject: [PATCH 05/53] fix cpu rt review comments Signed-off-by: songbuhuang <544824346@qq.com> --- src/daemon/executor/container_cb/execution_create.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/daemon/executor/container_cb/execution_create.c b/src/daemon/executor/container_cb/execution_create.c index feaa3064..cc9ae716 100644 --- a/src/daemon/executor/container_cb/execution_create.c +++ b/src/daemon/executor/container_cb/execution_create.c @@ -1327,7 +1327,7 @@ static int save_container_config_before_create(const char *id, const char *runti static int maybe_create_cpu_realtime_file(int64_t value, const char *file, const char *path) { int ret; - int fd = 0; + int fd = -1; ssize_t nwrite; char fpath[PATH_MAX] = { 0 }; char buf[ISULAD_NUMSTRLEN64] = { 0 }; @@ -1342,13 +1342,13 @@ static int maybe_create_cpu_realtime_file(int64_t value, const char *file, const return -1; } - int nret = snprintf(fpath, sizeof(fpath), "%s/%s", path, file); - if (nret < 0 || nret >= sizeof(fpath)) { + ret = snprintf(fpath, sizeof(fpath), "%s/%s", path, file); + if (ret < 0 || ret >= sizeof(fpath)) { ERROR("Failed to print string"); return -1; } - nret = snprintf(buf, sizeof(buf), "%lld", (long long int)value); - if (nret < 0 || (size_t)nret >= sizeof(buf)) { + ret = snprintf(buf, sizeof(buf), "%lld", (long long int)value); + if (ret < 0 || (size_t)ret >= sizeof(buf)) { ERROR("Failed to print string"); return -1; } -- 2.25.1