32 lines
1.1 KiB
Diff
32 lines
1.1 KiB
Diff
|
From 8ae5fc3c4506c53adc5aae4cd20ad2d9ac4c035a Mon Sep 17 00:00:00 2001
|
|||
|
From: grass-lu <284555125@qq.com>
|
|||
|
Date: Mon, 24 Jul 2023 15:22:17 +0800
|
|||
|
Subject: [PATCH 1/3] isolation: close file when exits
|
|||
|
MIME-Version: 1.0
|
|||
|
Content-Type: text/plain; charset=UTF-8
|
|||
|
Content-Transfer-Encoding: 8bit
|
|||
|
|
|||
|
The file is not closed,and the sock connection has not been truly closed, and it occupy connection for libvirtd
|
|||
|
|
|||
|
Signed-off-by: grass-lu <284555125@qq.com>
|
|||
|
---
|
|||
|
pkg/virt-handler/isolation/detector.go | 2 ++
|
|||
|
1 file changed, 2 insertions(+)
|
|||
|
|
|||
|
diff --git a/pkg/virt-handler/isolation/detector.go b/pkg/virt-handler/isolation/detector.go
|
|||
|
index 62f920025..9c282e231 100644
|
|||
|
--- a/pkg/virt-handler/isolation/detector.go
|
|||
|
+++ b/pkg/virt-handler/isolation/detector.go
|
|||
|
@@ -231,6 +231,8 @@ func (s *socketBasedIsolationDetector) getPid(socket string) (int, error) {
|
|||
|
if err != nil {
|
|||
|
return -1, err
|
|||
|
}
|
|||
|
+ defer ufile.Close()
|
|||
|
+
|
|||
|
// This is the tricky part, which will give us the PID of the owning socket
|
|||
|
ucreds, err := syscall.GetsockoptUcred(int(ufile.Fd()), syscall.SOL_SOCKET, syscall.SO_PEERCRED)
|
|||
|
if err != nil {
|
|||
|
--
|
|||
|
2.41.0
|
|||
|
|