mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Merge pull request #12593 from vrothberg/fix-11682
pause scope: don't use the global math/rand RNG
This commit is contained in:
@ -11,6 +11,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/containers/common/pkg/cgroups"
|
"github.com/containers/common/pkg/cgroups"
|
||||||
"github.com/containers/podman/v3/libpod/define"
|
"github.com/containers/podman/v3/libpod/define"
|
||||||
@ -204,8 +205,9 @@ func moveProcessToScope(pidPath, slice, scope string) error {
|
|||||||
func MovePauseProcessToScope(pausePidPath string) {
|
func MovePauseProcessToScope(pausePidPath string) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
for i := 0; i < 3; i++ {
|
state := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
r := rand.Int()
|
for i := 0; i < 10; i++ {
|
||||||
|
r := state.Int()
|
||||||
err = moveProcessToScope(pausePidPath, "user.slice", fmt.Sprintf("podman-pause-%d.scope", r))
|
err = moveProcessToScope(pausePidPath, "user.slice", fmt.Sprintf("podman-pause-%d.scope", r))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user