mirror of
https://github.com/golang/go.git
synced 2024-09-30 06:47:04 +00: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.
|
// A negative count means to read until EOF.
|
||||||
// Readdir returns the array and an Error, if any.
|
// Readdir returns the array and an Error, if any.
|
||||||
func (file *File) Readdir(count int) (fi []FileInfo, err Error) {
|
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
|
di := file.dirinfo
|
||||||
size := count
|
size := count
|
||||||
if size < 0 {
|
if size < 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user