mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-23 00:56:45 +01:00
caddyauth: Use buffered channel passed to signal.Notify (#3895)
The docs at os/signal.Notify warn about this signal delivery loss bug at https://golang.org/pkg/os/signal/#Notify, which says: Package signal will not block sending to c: the caller must ensure that c has sufficient buffer space to keep up with the expected signal rate. For a channel used for notification of just one signal value, a buffer of size 1 is sufficient. Caught by a static analysis tool from Orijtech, Inc. called "sigchanyzer"
This commit is contained in:
parent
a26f70a12b
commit
4cff36d731
1 changed files with 1 additions and 1 deletions
|
@ -70,7 +70,7 @@ func cmdHashPassword(fs caddycmd.Flags) (int, error) {
|
||||||
if terminal.IsTerminal(fd) {
|
if terminal.IsTerminal(fd) {
|
||||||
// ensure the terminal state is restored on SIGINT
|
// ensure the terminal state is restored on SIGINT
|
||||||
state, _ := terminal.GetState(fd)
|
state, _ := terminal.GetState(fd)
|
||||||
c := make(chan os.Signal)
|
c := make(chan os.Signal, 1)
|
||||||
signal.Notify(c, os.Interrupt)
|
signal.Notify(c, os.Interrupt)
|
||||||
go func() {
|
go func() {
|
||||||
<-c
|
<-c
|
||||||
|
|
Loading…
Reference in a new issue