mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
pkg/system: simplify IsAbs()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
6004b9ad52
commit
dec7a1befb
1 changed files with 3 additions and 5 deletions
|
@ -130,13 +130,11 @@ func mkdirWithACL(name string, sddl string) error {
|
||||||
// by the daemon. This SHOULD be treated as absolute from a docker processing
|
// by the daemon. This SHOULD be treated as absolute from a docker processing
|
||||||
// perspective.
|
// perspective.
|
||||||
func IsAbs(path string) bool {
|
func IsAbs(path string) bool {
|
||||||
if !filepath.IsAbs(path) {
|
if filepath.IsAbs(path) || strings.HasPrefix(path, string(os.PathSeparator)) {
|
||||||
if !strings.HasPrefix(path, string(os.PathSeparator)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// The origin of the functions below here are the golang OS and windows packages,
|
// The origin of the functions below here are the golang OS and windows packages,
|
||||||
// slightly modified to only cope with files, not directories due to the
|
// slightly modified to only cope with files, not directories due to the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue