1
0
mirror of https://github.com/golang/go synced 2024-11-16 19:14:43 -07:00
This commit is contained in:
Mateusz Poliwczak 2023-05-06 11:41:05 +02:00
parent 207e991b4b
commit 1ef021d167

View File

@ -7,7 +7,6 @@ package net
import (
"errors"
"internal/bytealg"
"io/fs"
"net/netip"
"sync"
"time"
@ -67,12 +66,10 @@ func readHosts() {
file, err := open(hp)
if err != nil {
// Return only on temporary errors, so that
// the hosts cache gets cleaned up on errors
// like: access, file not exist errors.
var pathError *fs.PathError
// Return only on temporary errors (EMFILE, ENFILE), so that
// the hosts cache gets cleaned up on errors like: access, file not exist.
var temporary interface{ Temporary() bool }
if errors.As(err, &pathError) && errors.As(pathError.Err, &temporary) && temporary.Temporary() {
if errors.As(err, &temporary) && temporary.Temporary() {
return
}
}