Compare commits
2 Commits
be27f00685
...
ef24d7980c
Author | SHA1 | Date | |
---|---|---|---|
ef24d7980c | |||
6228693b22 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
/hid/hid
|
||||
/hnc/hnc
|
||||
/hpcu/hpcu
|
||||
/hswg/hswg
|
||||
/ht/ht
|
||||
/prototypes/tls-autodetect
|
||||
/prototypes/xgb-draw
|
||||
|
16
hswg/main.go
16
hswg/main.go
@ -334,6 +334,15 @@ func dispatchEvents(dirname string, r io.Reader, ch chan<- *watchEvent) error {
|
||||
return err
|
||||
}
|
||||
|
||||
base := make([]byte, e.Len)
|
||||
if e.Len != 0 {
|
||||
if n, err := r.Read(base); err != nil {
|
||||
return err
|
||||
} else if n < int(e.Len) {
|
||||
return fmt.Errorf("short read")
|
||||
}
|
||||
}
|
||||
|
||||
switch {
|
||||
case e.Mask&syscall.IN_IGNORED != 0:
|
||||
return fmt.Errorf("watch removed by kernel")
|
||||
@ -345,13 +354,6 @@ func dispatchEvents(dirname string, r io.Reader, ch chan<- *watchEvent) error {
|
||||
continue
|
||||
}
|
||||
|
||||
base := make([]byte, e.Len)
|
||||
if n, err := r.Read(base); err != nil {
|
||||
return err
|
||||
} else if n < int(e.Len) {
|
||||
return fmt.Errorf("short read")
|
||||
}
|
||||
|
||||
basename, interesting := string(base[:bytes.IndexByte(base, 0)]), false
|
||||
for _, glob := range globs {
|
||||
if matches, _ := filepath.Match(glob, basename); matches {
|
||||
|
Loading…
x
Reference in New Issue
Block a user