mirror of
https://github.com/docker/docs.git
synced 2026-04-05 10:48:55 +07:00
Canonicalize our root path before we try using it, because we make assumptions about it not containing symlinks
Fixes #3242
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/dotcloud/docker/utils"
|
"github.com/dotcloud/docker/utils"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -69,6 +70,20 @@ func main() {
|
|||||||
flag.Usage()
|
flag.Usage()
|
||||||
return
|
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)
|
eng, err := engine.New(*flRoot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user