mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2025-01-03 01:07:39 +00:00
cmd/clef: don't check file permissions on windows (#22251)
Fixes #20123
This commit is contained in:
parent
7a800f98f6
commit
f25b437b70
@ -805,14 +805,16 @@ func readMasterKey(ctx *cli.Context, ui core.UIClientAPI) ([]byte, error) {
|
|||||||
|
|
||||||
// checkFile is a convenience function to check if a file
|
// checkFile is a convenience function to check if a file
|
||||||
// * exists
|
// * exists
|
||||||
// * is mode 0400
|
// * is mode 0400 (unix only)
|
||||||
func checkFile(filename string) error {
|
func checkFile(filename string) error {
|
||||||
info, err := os.Stat(filename)
|
info, err := os.Stat(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed stat on %s: %v", filename, err)
|
return fmt.Errorf("failed stat on %s: %v", filename, err)
|
||||||
}
|
}
|
||||||
// Check the unix permission bits
|
// Check the unix permission bits
|
||||||
if info.Mode().Perm()&0377 != 0 {
|
// However, on windows, we cannot use the unix perm-bits, see
|
||||||
|
// https://github.com/ethereum/go-ethereum/issues/20123
|
||||||
|
if runtime.GOOS != "windows" && info.Mode().Perm()&0377 != 0 {
|
||||||
return fmt.Errorf("file (%v) has insecure file permissions (%v)", filename, info.Mode().String())
|
return fmt.Errorf("file (%v) has insecure file permissions (%v)", filename, info.Mode().String())
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user