This commit is contained in:
Sun Yimin 2022-08-17 15:30:21 +08:00 committed by GitHub
parent c2efe31957
commit a507f61c7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,9 +78,9 @@ func loadSystemRoots() (*CertPool, error) {
return nil, firstErr return nil, firstErr
} }
// readUniqueDirectoryEntries is like ioutil.ReadDir but omits // readUniqueDirectoryEntries is like os.ReadDir but omits
// symlinks that point within the directory. // symlinks that point within the directory.
func readUniqueDirectoryEntries(dir string) ([]os.FileInfo, error) { func readUniqueDirectoryEntries(dir string) ([]fs.DirEntry, error) {
files, err := os.ReadDir(dir) files, err := os.ReadDir(dir)
if err != nil { if err != nil {
return nil, err return nil, err
@ -94,6 +94,7 @@ func readUniqueDirectoryEntries(dir string) ([]os.FileInfo, error) {
return uniq, nil return uniq, nil
} }
// isSameDirSymlink reports whether fi in dir is a symlink with a // isSameDirSymlink reports whether fi in dir is a symlink with a
// target not containing a slash. // target not containing a slash.
func isSameDirSymlink(f fs.DirEntry, dir string) bool { func isSameDirSymlink(f fs.DirEntry, dir string) bool {