mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Handle empty values for XDG_RUNTIME_DIR properly.
Fixes #6849 PiperOrigin-RevId: 413322019
This commit is contained in:
@@ -126,7 +126,8 @@ func NewFromFlags() (*Config, error) {
|
||||
if len(conf.RootDir) == 0 {
|
||||
// If not set, set default root dir to something (hopefully) user-writeable.
|
||||
conf.RootDir = "/var/run/runsc"
|
||||
if runtimeDir, ok := os.LookupEnv("XDG_RUNTIME_DIR"); ok {
|
||||
// NOTE: empty values for XDG_RUNTIME_DIR should be ignored.
|
||||
if runtimeDir := os.Getenv("XDG_RUNTIME_DIR"); runtimeDir != "" {
|
||||
conf.RootDir = filepath.Join(runtimeDir, "runsc")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user