1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #3263 from tianon/abspath-root

Canonicalize our root path before we try using it
This commit is contained in:
Victor Vieux 2013-12-18 11:41:47 -08:00
commit f768c6adb7

View file

@ -9,6 +9,7 @@ import (
"github.com/dotcloud/docker/utils"
"log"
"os"
"path/filepath"
"strings"
)
@ -69,6 +70,20 @@ func main() {
flag.Usage()
return
}
// Docker makes some assumptions about the "absoluteness" of flRoot
// ... so let's make sure it has no symlinks
if p, err := filepath.Abs(*flRoot); err != nil {
log.Fatalf("Unable to get absolute root (%s): %s", flRoot, err)
} else {
*flRoot = p
}
if p, err := filepath.EvalSymlinks(*flRoot); err != nil {
log.Fatalf("Unable to canonicalize root (%s): %s", flRoot, err)
} else {
*flRoot = p
}
eng, err := engine.New(*flRoot)
if err != nil {
log.Fatal(err)