From bd18051dade97d4f75346cb67beea551a38ca13e Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Tue, 23 Apr 2024 20:52:04 +0800
Subject: [PATCH 75/75] bugfix for setting cpu-rt to a negative value when env
 not supports cpu-rt

Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
 src/daemon/modules/spec/verify.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/daemon/modules/spec/verify.c b/src/daemon/modules/spec/verify.c
index 617b7f23..57e16ef9 100644
--- a/src/daemon/modules/spec/verify.c
+++ b/src/daemon/modules/spec/verify.c
@@ -381,14 +381,14 @@ static int verify_cpu_realtime(const sysinfo_t *sysinfo, int64_t realtime_period
 {
     int ret = 0;
 
-    if (realtime_period > 0 && !(sysinfo->cgcpuinfo.cpu_rt_period)) {
+    if (realtime_period != 0 && !(sysinfo->cgcpuinfo.cpu_rt_period)) {
         ERROR("Invalid --cpu-rt-period: Your kernel does not support cgroup rt period");
         isulad_set_error_message("Invalid --cpu-rt-period: Your kernel does not support cgroup rt period");
         ret = -1;
         goto out;
     }
 
-    if (realtime_runtime > 0 && !(sysinfo->cgcpuinfo.cpu_rt_runtime)) {
+    if (realtime_runtime != 0 && !(sysinfo->cgcpuinfo.cpu_rt_runtime)) {
         ERROR("Invalid --cpu-rt-runtime: Your kernel does not support cgroup rt runtime");
         isulad_set_error_message("Invalid --cpu-rt-period: Your kernel does not support cgroup rt runtime");
         ret = -1;
-- 
2.25.1

