Skip to content

Commit

Permalink
time: return ENOENT instead of ERROR_PATH_NOT_FOUND in windows
Browse files Browse the repository at this point in the history
When using windows some users got a weird error (File not found) when the timezone database is not found. It happens because some methods in the time package don't treat ERROR_PATH_NOT_FOUND and ENOTDIR. To solve it was added a conversion to ENOTENT error.

Fixes #50248
  • Loading branch information
rlanhellas committed Jan 31, 2022
1 parent d6c2a63 commit e763962
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/time/sys_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func interrupt() {
func open(name string) (uintptr, error) {
fd, err := syscall.Open(name, syscall.O_RDONLY, 0)
if err != nil {
//This condition solves issue 50248 (https://github.com/golang/go/issues/50248)
if err == syscall.ERROR_PATH_NOT_FOUND {
err = syscall.ENOENT
}
Expand Down

0 comments on commit e763962

Please sign in to comment.