|
func checkFile(f string) error { |
|
if utils.FileExists(f) { |
|
fmt.Printf("%s already exists.\n", f) |
|
s, err := askpass.ReadPassphrase("Overwrite (y/n)? ", askpass.RP_ALLOW_STDIN|askpass.RPP_ECHO_ON) |
|
if err != nil { |
|
return err |
|
} |
|
if !bytes.Equal(s, []byte("y")) { |
|
return nil |
|
} |
|
} |
|
return nil |
|
} |
The checkFile method returns nil if the prompt returns something other than "y", but then returns nil anyway below. Looking at the call sites, think that an error should be returned instead of nil in this (value != "y") case, and then return nil otherwise.
ssh-tpm-agent/cmd/ssh-tpm-keygen/main.go
Lines 358 to 370 in 3854ff2
The
checkFilemethod returnsnilif the prompt returns something other than "y", but then returns nil anyway below. Looking at the call sites, think that an error should be returned instead of nil in this (value != "y") case, and then return nil otherwise.