mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
pkg/filenotify/poller: fix Close()
The code in Close() that removes the watches was not working, because it first sets `w.closed = true` and then calls w.close(), which starts with ``` if w.closed { return errPollerClosed } ``` Fix by setting w.closed only after calling w.remove() for all the files being watched. While at it, remove the duplicated `delete(w.watches, name)` code. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
dfbb64ea7d
commit
fffa8958d0
1 changed files with 1 additions and 2 deletions
|
@ -115,11 +115,10 @@ func (w *filePoller) Close() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
w.closed = true
|
|
||||||
for name := range w.watches {
|
for name := range w.watches {
|
||||||
w.remove(name)
|
w.remove(name)
|
||||||
delete(w.watches, name)
|
|
||||||
}
|
}
|
||||||
|
w.closed = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue