stubbing out more plugins
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
0f0ce2af37
commit
c02aa0e395
7 changed files with 171 additions and 62 deletions
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
@ -10,6 +9,7 @@ import (
|
|||
"git.thisco.de/vbatts/fuzz-walker/walker"
|
||||
)
|
||||
|
||||
// NewFuzzer creates the fuzzer for this plugin
|
||||
func NewFuzzer() (walker.Fuzzer, error) {
|
||||
return &myFuzzer{}, nil
|
||||
}
|
||||
|
@ -21,22 +21,16 @@ func (mf myFuzzer) Name() string {
|
|||
}
|
||||
|
||||
func (mf myFuzzer) Func(path string, info os.FileInfo, timeout time.Duration) error {
|
||||
c1 := make(chan error, 1)
|
||||
go func() {
|
||||
fd, err := os.Open(path)
|
||||
if err != nil {
|
||||
c1 <- err
|
||||
}
|
||||
defer fd.Close()
|
||||
_, err = io.Copy(ioutil.Discard, fd)
|
||||
c1 <- err
|
||||
}()
|
||||
|
||||
select {
|
||||
case err := <-c1:
|
||||
return err
|
||||
case <-time.After(timeout):
|
||||
return fmt.Errorf("timeout reached")
|
||||
if !info.Mode().IsRegular() {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
|
||||
fd, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer fd.Close()
|
||||
|
||||
_, err = io.Copy(ioutil.Discard, fd)
|
||||
return err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue