mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
libpod: Ensure that generated container names are random
Fixes #15569. Signed-off-by: Doug Rabson <dfr@rabson.org>
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -112,6 +113,13 @@ type Runtime struct {
|
||||
secretsManager *secrets.SecretsManager
|
||||
}
|
||||
|
||||
func init() {
|
||||
// generateName calls namesgenerator.GetRandomName which the
|
||||
// global RNG from math/rand. Seed it here to make sure we
|
||||
// don't get the same name every time.
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
// SetXdgDirs ensures the XDG_RUNTIME_DIR env and XDG_CONFIG_HOME variables are set.
|
||||
// containers/image uses XDG_RUNTIME_DIR to locate the auth file, XDG_CONFIG_HOME is
|
||||
// use for the containers.conf configuration file.
|
||||
|
Reference in New Issue
Block a user