Skip to content

Commit

Permalink
Fix error check in session.Secret
Browse files Browse the repository at this point in the history
Windows may return an error other than those matching os.IsNotExist(),
such as ERROR_INVALID_NAME.  Use os.IsPermission() instead.

Fixes vmware#1612
  • Loading branch information
dougm committed Sep 18, 2019
1 parent 1e46ee5 commit c622654
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions session/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ func Secret(value string) (string, error) {
}
contents, err := ioutil.ReadFile(value)
if err != nil {
if os.IsNotExist(err) {
return value, nil
if os.IsPermission(err) {
return "", err
}
return "", err
return value, nil
}
return strings.TrimSpace(string(contents)), nil
}
Expand Down

0 comments on commit c622654

Please sign in to comment.