summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorCuong Manh Le <[email protected]>2020-12-01 22:27:46 +0700
committerGitHub <[email protected]>2020-12-01 08:27:46 -0700
commit4cff36d731390915649261f0e9c088be0eeafcf1 (patch)
tree9b387b83815ca6ed6929a6b0a468ffbf88c182a2 /modules
parenta26f70a12b1289231d705bc002fe1df3180cb6c5 (diff)
downloadcaddy-4cff36d731390915649261f0e9c088be0eeafcf1.tar.gz
caddy-4cff36d731390915649261f0e9c088be0eeafcf1.zip
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"
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/caddyauth/command.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/caddyhttp/caddyauth/command.go b/modules/caddyhttp/caddyauth/command.go
index f445f67d6..a2ae75581 100644
--- a/modules/caddyhttp/caddyauth/command.go
+++ b/modules/caddyhttp/caddyauth/command.go
@@ -70,7 +70,7 @@ func cmdHashPassword(fs caddycmd.Flags) (int, error) {
if terminal.IsTerminal(fd) {
// ensure the terminal state is restored on SIGINT
state, _ := terminal.GetState(fd)
- c := make(chan os.Signal)
+ c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func() {
<-c