mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
when the systemd cgroup manager is used, controllers not handled by systemd are created manually afterwards. libcontainer didn't correctly cleanup these cgroups that were leaked on cgroup v1. Closes: https://github.com/kubernetes/kubernetes/issues/92766 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
17 lines
322 B
Go
17 lines
322 B
Go
package internal
|
|
|
|
import "errors"
|
|
|
|
// DiscardZeroes makes sure that all written bytes are zero
|
|
// before discarding them.
|
|
type DiscardZeroes struct{}
|
|
|
|
func (DiscardZeroes) Write(p []byte) (int, error) {
|
|
for _, b := range p {
|
|
if b != 0 {
|
|
return 0, errors.New("encountered non-zero byte")
|
|
}
|
|
}
|
|
return len(p), nil
|
|
}
|