Skip to content

Commit d3e2ca5

Browse files
committed
libpod: stats catch ErrStatCgroup
Stat() actually ignored ENOENT errors so there is no point in matching them, instead of Stat() does not find a valid cgroup file it returns ErrStatCgroup so match that instead. Signed-off-by: Paul Holzinger <[email protected]>
1 parent 86d7da8 commit d3e2ca5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libpod/stats_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (c *Container) getPlatformContainerStats(stats *define.ContainerStats, prev
3838
if err != nil {
3939
// cgroup.Stat() is not an atomic operation, so it is possible that the cgroup is removed
4040
// while Stat() is running. Try to catch this case and return a more specific error.
41-
if (errors.Is(err, unix.ENOENT) || errors.Is(err, unix.ENODEV)) && !cgroupExist(cgroupPath) {
41+
if (errors.Is(err, cgroups.ErrStatCgroup) || errors.Is(err, unix.ENODEV)) && !cgroupExist(cgroupPath) {
4242
return fmt.Errorf("cgroup %s does not exist: %w", cgroupPath, define.ErrCtrStopped)
4343
}
4444
return fmt.Errorf("unable to obtain cgroup stats: %w", err)

0 commit comments

Comments
 (0)