diff --git a/cli/config/configfile/file.go b/cli/config/configfile/file.go index 2fa34f909437..a94451e7813a 100644 --- a/cli/config/configfile/file.go +++ b/cli/config/configfile/file.go @@ -169,12 +169,8 @@ func (configFile *ConfigFile) Save() (retErr error) { // Handle situation where the configfile is a symlink cfgFile := configFile.Filename - if f, err := os.Readlink(cfgFile); err == nil { + if f, err := filepath.EvalSymlinks(cfgFile); err == nil { 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