From 69de43f3f474691a97f81c5ea595442f7f63049b Mon Sep 17 00:00:00 2001 From: Vicente Cheng Date: Wed, 24 Jan 2024 16:46:39 +0800 Subject: [PATCH] uevent: should close uevent channel Signed-off-by: Vicente Cheng --- pkg/udev/uevent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/udev/uevent.go b/pkg/udev/uevent.go index b74620a1..0f0572f2 100644 --- a/pkg/udev/uevent.go +++ b/pkg/udev/uevent.go @@ -74,6 +74,7 @@ func (u *Udev) monitor(ctx context.Context, errors chan error) { uqueue := make(chan netlink.UEvent) errChan := make(chan error) quit := conn.Monitor(uqueue, errChan, matcher) + defer close(quit) // simulator the error from udev monitor if u.injectError { @@ -91,7 +92,6 @@ func (u *Udev) monitor(ctx context.Context, errors chan error) { errors <- err return case <-ctx.Done(): - close(quit) return } }