write and update the netrc with safe perms

This commit is contained in:
Abel Luck 2026-02-26 11:25:20 +01:00
parent a3991af0ae
commit e0c0cb6f32
2 changed files with 28 additions and 1 deletions

View file

@ -132,5 +132,8 @@ func write(path string, entries []entry) error {
fmt.Fprintf(&b, "machine %s\npassword %s\n", e.machine, e.password)
}
return os.WriteFile(path, []byte(b.String()), 0600)
if err := os.WriteFile(path, []byte(b.String()), 0600); err != nil {
return err
}
return os.Chmod(path, 0600)
}