Skip to content

Commit f25b437

Browse files
authored
cmd/clef: don't check file permissions on windows (#22251)
Fixes #20123
1 parent 7a800f9 commit f25b437

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmd/clef/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,14 +805,16 @@ func readMasterKey(ctx *cli.Context, ui core.UIClientAPI) ([]byte, error) {
805805

806806
// checkFile is a convenience function to check if a file
807807
// * exists
808-
// * is mode 0400
808+
// * is mode 0400 (unix only)
809809
func checkFile(filename string) error {
810810
info, err := os.Stat(filename)
811811
if err != nil {
812812
return fmt.Errorf("failed stat on %s: %v", filename, err)
813813
}
814814
// Check the unix permission bits
815-
if info.Mode().Perm()&0377 != 0 {
815+
// However, on windows, we cannot use the unix perm-bits, see
816+
// https://github.com/ethereum/go-ethereum/issues/20123
817+
if runtime.GOOS != "windows" && info.Mode().Perm()&0377 != 0 {
816818
return fmt.Errorf("file (%v) has insecure file permissions (%v)", filename, info.Mode().String())
817819
}
818820
return nil

0 commit comments

Comments
 (0)