summaryrefslogtreecommitdiff
path: root/0005-fix-cpu-rt-review-comments.patch
blob: d5f812dcc641c630f4e2ad82f0cdc0381970f1d9 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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