mirror of https://github.com/docker/cli.git
Update cli/config/configfile/file.go
use filepath.EvalSymlink instead of check with filepath.IsAbs Co-authored-by: Paweł Gronowski <me@woland.xyz> Signed-off-by: Will Wang <willww64@gmail.com>
This commit is contained in:
parent
c90705a413
commit
115fdd979b
|
@ -169,12 +169,8 @@ func (configFile *ConfigFile) Save() (retErr error) {
|
||||||
|
|
||||||
// Handle situation where the configfile is a symlink
|
// Handle situation where the configfile is a symlink
|
||||||
cfgFile := configFile.Filename
|
cfgFile := configFile.Filename
|
||||||
if f, err := os.Readlink(cfgFile); err == nil {
|
if f, err := filepath.EvalSymlinks(cfgFile); err == nil {
|
||||||
cfgFile = f
|
cfgFile = f
|
||||||
// The target of a symlink can be a relative path, ensure the final path is absolute
|
|
||||||
if !filepath.IsAbs(f) {
|
|
||||||
cfgFile = filepath.Join(dir, f)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try copying the current config file (if any) ownership and permissions
|
// Try copying the current config file (if any) ownership and permissions
|
||||||
|
|
Loading…
Reference in New Issue