diff options
author | Pasha <pasha@member.fsf.org> | 2023-07-19 08:05:25 +0000 |
---|---|---|
committer | Pasha <pasha@member.fsf.org> | 2023-07-19 08:05:25 +0000 |
commit | fb1223e91bb49d3a91b869d4c347e86566481ee5 (patch) | |
tree | 801ecc541bce366a2d2fa9afe226b16b929f8684 | |
parent | 1a13003efe953b88b34fcadef536bb09859bad34 (diff) | |
download | containercgroup-fb1223e91bb49d3a91b869d4c347e86566481ee5.tar.gz containercgroup-fb1223e91bb49d3a91b869d4c347e86566481ee5.tar.bz2 |
-rw-r--r-- | lib/cgroup_file_handle.c | 3 | ||||
-rw-r--r-- | src/main.c | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/cgroup_file_handle.c b/lib/cgroup_file_handle.c index 7097b10..184e02d 100644 --- a/lib/cgroup_file_handle.c +++ b/lib/cgroup_file_handle.c @@ -74,8 +74,7 @@ int get_cgroup_file_handle(const char *pathname, char *cgroupfhp) { goto clean_exit; } - memcpy(cgroupfhp, fhp->f_handle, - sizeof(unsigned char) * CGROUP_FILE_HANDLE_BYTES); + memcpy(cgroupfhp, fhp->f_handle, CGROUP_FILE_HANDLE_BYTES); ret = 1; clean_exit: @@ -28,8 +28,7 @@ enum output_pref { DEFAULT = 0, PATH = 1, CGROUPID = 2 }; static inline void print_cgroup_file_handle(const char *pathname, enum output_pref output_type) { - unsigned char *cgroupfhp = - (unsigned char *)malloc(sizeof(unsigned char) * CGROUP_FILE_HANDLE_BYTES); + unsigned char *cgroupfhp = (unsigned char *)malloc(CGROUP_FILE_HANDLE_BYTES); if (!cgroupfhp) { fprintf(stderr, "Cannot allocate memory for cgroup file handle\n"); return; @@ -116,8 +115,8 @@ static int display_controller_data(char *ctr_name, char *ctr_path, base_path[1] = '\0'; depth = 0; - ret = - cgroup_walk_tree_begin(ctr_name, base_path, depth, &handle, &info, &base_level); + ret = cgroup_walk_tree_begin(ctr_name, base_path, depth, &handle, &info, + &base_level); if (ret != 0) return ret; @@ -136,7 +135,8 @@ static int display_controller_data(char *ctr_name, char *ctr_path, return 1; } - while ((ret = cgroup_walk_tree_next(depth, &handle, &info, base_level)) == 0) { + while ((ret = cgroup_walk_tree_next(depth, &handle, &info, base_level)) == + 0) { if (compare_cgroup_search_name(info.path, cgroup_search_name)) { print_info(&info, len, ctr_path, output_type); break; |