mirror of
https://github.com/restic/restic.git
synced 2026-06-10 19:09:44 +00:00
windows: fix hang while reading from directory
This commit is contained in:
@@ -71,6 +71,10 @@ func ResetPermissions(path string) error {
|
||||
// Readdirnames returns a list of file in a directory. Flags are passed to fs.OpenFile.
|
||||
// O_RDONLY and O_DIRECTORY are implied.
|
||||
func Readdirnames(filesystem FS, dir string, flags int) ([]string, error) {
|
||||
// cleanup internal flag that conflicts with actual windows API flags
|
||||
if runtime.GOOS == "windows" {
|
||||
flags &^= O_NOFOLLOW
|
||||
}
|
||||
f, err := filesystem.OpenFile(dir, O_RDONLY|O_DIRECTORY|flags, false)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("openfile for readdirnames failed: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user