35 lines
1.1 KiB
Diff
35 lines
1.1 KiB
Diff
From 6085c67cce5d4c5495e9a585d137b79af1b1598e Mon Sep 17 00:00:00 2001
|
|
From: jikai <jikai11@huawei.com>
|
|
Date: Tue, 19 Dec 2023 15:41:05 +0800
|
|
Subject: [PATCH] check cgroup path empty while setting freezer
|
|
|
|
Signed-off-by: jikai <jikai11@huawei.com>
|
|
---
|
|
src/lxc/start.c | 8 +++++++-
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/lxc/start.c b/src/lxc/start.c
|
|
index ec64546..c01eb9b 100644
|
|
--- a/src/lxc/start.c
|
|
+++ b/src/lxc/start.c
|
|
@@ -1020,9 +1020,15 @@ static int get_all_pids(struct cgroup_ops *cg_ops, pid_t **pids, size_t *len)
|
|
static int set_cgroup_freezer(struct cgroup_ops *cg_ops, const char *value)
|
|
{
|
|
char *fullpath;
|
|
+ const char *cgroup_path;
|
|
int ret;
|
|
|
|
- fullpath = must_make_path(cg_ops->get_cgroup_full_path(cg_ops, "freezer"), "freezer.state", NULL);
|
|
+ cgroup_path = cg_ops->get_cgroup_full_path(cg_ops, "freezer");
|
|
+ if (cgroup_path == NULL) {
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ fullpath = must_make_path(cgroup_path, "freezer.state", NULL);
|
|
ret = lxc_write_to_file(fullpath, value, strlen(value), false, 0666);
|
|
free(fullpath);
|
|
return ret;
|
|
--
|
|
2.33.0
|
|
|