From c05c92988577067ea376a2e7263a2c9080fcb478 Mon Sep 17 00:00:00 2001
From: songbuhuang <544824346@qq.com>
Date: Mon, 13 Feb 2023 10:43:52 +0800
Subject: [PATCH 08/19] 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 da01a57f..04154765 100644
--- a/src/daemon/executor/container_cb/execution_create.c
+++ b/src/daemon/executor/container_cb/execution_create.c
@@ -1295,7 +1295,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 };
@@ -1310,13 +1310,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

