mirror of
https://github.com/golang/go
synced 2024-11-22 03:24:41 -07:00
os: check for valid arguments in windows Readdir
Fixes #1129. R=rsc, brainman CC=Joe Poirier, golang-dev https://golang.org/cl/2211045
This commit is contained in:
parent
7c9f0f0109
commit
bfb127612a
@ -113,6 +113,12 @@ func (file *File) Stat() (fi *FileInfo, err Error) {
|
||||
// A negative count means to read until EOF.
|
||||
// Readdir returns the array and an Error, if any.
|
||||
func (file *File) Readdir(count int) (fi []FileInfo, err Error) {
|
||||
if file == nil || file.fd < 0 {
|
||||
return nil, EINVAL
|
||||
}
|
||||
if !file.isdir() {
|
||||
return nil, &PathError{"Readdir", file.name, ENOTDIR}
|
||||
}
|
||||
di := file.dirinfo
|
||||
size := count
|
||||
if size < 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user