Skip to content

Commit

Permalink
cgroup: skip parsing empty file
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information
giuseppe committed Mar 18, 2021
1 parent dea7fa0 commit 1ecc6ba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libcrun/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,9 @@ read_pids_cgroup (int dfd, bool recurse, pid_t **pids, size_t *n_pids, size_t *a
if (UNLIKELY (ret < 0))
return ret;

if (len == 0)
return 0;

for (n_new_pids = 0, it = buffer; it; it = strchr (it + 1, '\n'))
n_new_pids++;

Expand Down

0 comments on commit 1ecc6ba

Please sign in to comment.