Skip to content

Commit

Permalink
Merge pull request #1510 from giuseppe/error-out-invalid-dirs
Browse files Browse the repository at this point in the history
options: reject empty runroot or graphroot
  • Loading branch information
rhatdan authored Feb 21, 2023
2 parents 0d8301b + 9ebdbd9 commit cfffdac
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions types/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,24 @@ func defaultStoreOptionsIsolated(rootless bool, rootlessUID int, storageConf str
}
}
}
if storageOpts.RunRoot != "" {
runRoot, err := expandEnvPath(storageOpts.RunRoot, rootlessUID)
if err != nil {
return storageOpts, err
}
storageOpts.RunRoot = runRoot
if storageOpts.RunRoot == "" {
return storageOpts, fmt.Errorf("runroot must be set")
}
if storageOpts.GraphRoot != "" {
graphRoot, err := expandEnvPath(storageOpts.GraphRoot, rootlessUID)
if err != nil {
return storageOpts, err
}
storageOpts.GraphRoot = graphRoot
runRoot, err := expandEnvPath(storageOpts.RunRoot, rootlessUID)
if err != nil {
return storageOpts, err
}
storageOpts.RunRoot = runRoot

if storageOpts.GraphRoot == "" {
return storageOpts, fmt.Errorf("graphroot must be set")
}
graphRoot, err := expandEnvPath(storageOpts.GraphRoot, rootlessUID)
if err != nil {
return storageOpts, err
}
storageOpts.GraphRoot = graphRoot

if storageOpts.RootlessStoragePath != "" {
storagePath, err := expandEnvPath(storageOpts.RootlessStoragePath, rootlessUID)
if err != nil {
Expand Down

0 comments on commit cfffdac

Please sign in to comment.