From: Kamalesh Babulal Date: Tue, 1 Oct 2024 06:47:12 +0000 (+0530) Subject: api.c: constify cgroup_get_procs() arguments X-Git-Tag: v3.2.0~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c4bdc99cb9b89cd93fe52f287e88b4970aa083aa;p=thirdparty%2Flibcgroup.git 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 --- 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];