Skip to content

Commit b2929d0

Browse files
committed
fix
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 134a5d5 commit b2929d0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

config/config.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func saveConfig(cfg *Config) *Config {
263263
conf.Section(defaultCoreConfig.ProfileName).ReflectFrom(&defaultProfile)
264264
conf.SaveTo(cfg.ConfigFile)
265265
}
266-
makeFileGroupPrivate(cfg.ConfigFile)
266+
makeFileUserPrivate(cfg.ConfigFile)
267267

268268
conf := readConfig(cfg)
269269

@@ -320,7 +320,7 @@ func saveConfig(cfg *Config) *Config {
320320
}
321321

322322
if cfg.HistoryFile != "" {
323-
makeFileGroupPrivate(cfg.HistoryFile)
323+
makeFileUserPrivate(cfg.HistoryFile)
324324
}
325325

326326
return cfg
@@ -396,9 +396,11 @@ func (c *Config) UpdateConfig(key string, value string, update bool) {
396396
}
397397
}
398398

399-
func makeFileGroupPrivate(filePath string) {
399+
func makeFileUserPrivate(filePath string) {
400400
if fi, err := os.Stat(filePath); err == nil && fi.Mode().IsRegular() {
401-
_ = os.Chmod(filePath, 0660)
401+
if err := os.Chmod(filePath, 0600); err != nil {
402+
fmt.Printf("Failed to set permissions on %s: %v\n", filePath, err)
403+
}
402404
}
403405
}
404406

0 commit comments

Comments
 (0)