mirror of
https://github.com/opencontainers/runc.git
synced 2025-09-27 03:46:19 +08:00
Convert root path to absolute path on create command
Signed-off-by: Amim Knabben <amim.knabben@gmail.com>
This commit is contained in:
3
main.go
3
main.go
@@ -141,6 +141,9 @@ func main() {
|
||||
fatal(err)
|
||||
}
|
||||
}
|
||||
if err := reviseRootDir(context); err != nil {
|
||||
return err
|
||||
}
|
||||
return logs.ConfigureLogging(createLogConfig(context))
|
||||
}
|
||||
|
||||
|
15
utils.go
15
utils.go
@@ -92,6 +92,21 @@ func revisePidFile(context *cli.Context) error {
|
||||
return context.Set("pid-file", pidFile)
|
||||
}
|
||||
|
||||
// reviseRootDir convert the root to absolute path
|
||||
func reviseRootDir(context *cli.Context) error {
|
||||
root := context.GlobalString("root")
|
||||
if root == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
root, err := filepath.Abs(root)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return context.GlobalSet("root", root)
|
||||
}
|
||||
|
||||
// parseBoolOrAuto returns (nil, nil) if s is empty or "auto"
|
||||
func parseBoolOrAuto(s string) (*bool, error) {
|
||||
if s == "" || strings.ToLower(s) == "auto" {
|
||||
|
Reference in New Issue
Block a user