From c4bdc99cb9b89cd93fe52f287e88b4970aa083aa Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Tue, 1 Oct 2024 12:17:12 +0530 Subject: [PATCH] api.c: constify cgroup_get_procs() arguments Constify the char* functional arguments of cgroup_get_procs(), these parameters are not supposed to changed. Fixes: https://github.com/libcgroup/libcgroup/issues/445 Reported-by: Dan Dedrick Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- include/libcgroup/groups.h | 2 +- src/api.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/libcgroup/groups.h b/include/libcgroup/groups.h index 4fd3169f..2def31c2 100644 --- a/include/libcgroup/groups.h +++ b/include/libcgroup/groups.h @@ -586,7 +586,7 @@ char *cgroup_get_value_name(struct cgroup_controller *controller, int index); * to the API. Should be freed by the caller using free. * @param size The size of the pids array returned by the API. */ -int cgroup_get_procs(char *name, char *controller, pid_t **pids, int *size); +int cgroup_get_procs(const char *name, const char *controller, pid_t **pids, int *size); /** * Get the list of threads in a cgroup. This list is guaranteed to diff --git a/src/api.c b/src/api.c index e3644ffc..18a48367 100644 --- a/src/api.c +++ b/src/api.c @@ -6240,7 +6240,7 @@ static int read_pids(char *path, pid_t **pids, int *size) return 0; } -int cgroup_get_procs(char *name, char *controller, pid_t **pids, int *size) +int cgroup_get_procs(const char *name, const char *controller, pid_t **pids, int *size) { char cgroup_path[FILENAME_MAX]; -- 2.47.3