]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
api.c: constify cgroup_get_procs() arguments
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 1 Oct 2024 06:47:12 +0000 (12:17 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 7 Oct 2024 21:18:04 +0000 (15:18 -0600)
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 <dan.dedrick@gmail.com>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
include/libcgroup/groups.h
src/api.c

index 4fd3169ff1517f592434ac0d5550c1eb091ee8da..2def31c2b0ec9d04ff9299c253e1c77ba937804d 100644 (file)
@@ -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
index e3644ffc760dbe150d869f58ad80c54f5de35044..18a4836796e611e4129d0b9b043167878697d964 100644 (file)
--- 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];