Commit bfb12761 authored by Peter Mundy's avatar Peter Mundy Committed by Russ Cox

os: check for valid arguments in windows Readdir

Fixes #1129.

R=rsc, brainman
CC=Joe Poirier, golang-dev
https://golang.org/cl/2211045
parent 7c9f0f01
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment