From 4cff36d731390915649261f0e9c088be0eeafcf1 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Tue, 1 Dec 2020 22:27:46 +0700 Subject: 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" --- modules/caddyhttp/caddyauth/command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/caddyhttp') diff --git a/modules/caddyhttp/caddyauth/command.go b/modules/caddyhttp/caddyauth/command.go index f445f67..a2ae755 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 -- cgit v1.2.3