diff options
author | Thomas Haller <thaller@redhat.com> | 2023-10-24 11:57:07 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-11-09 12:34:42 +0100 |
commit | 1f867d0d07122f54f76e20af3c636ce66102b683 (patch) | |
tree | e105a7598528ca03b2d0fa98c3f2728d5a640172 /src/datatype.c | |
parent | cb9b72a43c5684379c027908d9f332170bf8dd15 (diff) |
datatype: don't return a const string from cgroupv2_get_path()
The caller is supposed to free the allocated string. Return a non-const
string to make that clearer.
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/datatype.c')
-rw-r--r-- | src/datatype.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/datatype.c b/src/datatype.c index 64e4647a..63627358 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -1465,10 +1465,10 @@ const struct datatype policy_type = { #define SYSFS_CGROUPSV2_PATH "/sys/fs/cgroup" -static const char *cgroupv2_get_path(const char *path, uint64_t id) +static char *cgroupv2_get_path(const char *path, uint64_t id) { - const char *cgroup_path = NULL; char dent_name[PATH_MAX + 1]; + char *cgroup_path = NULL; struct dirent *dent; struct stat st; DIR *d; @@ -1506,7 +1506,7 @@ static void cgroupv2_type_print(const struct expr *expr, struct output_ctx *octx) { uint64_t id = mpz_get_uint64(expr->value); - const char *cgroup_path; + char *cgroup_path; cgroup_path = cgroupv2_get_path(SYSFS_CGROUPSV2_PATH, id); if (cgroup_path) |