containerd/patch/0098-containerd-remove-socket-file-when-get-file-fd-failed.patch
2023-09-22 13:58:07 +08:00

28 lines
955 B
Diff

From 5c23af4ebbb9161f776833694270d5c08bd4b8df Mon Sep 17 00:00:00 2001
From: chenjiankun <chenjiankun1@huawei.com>
Date: Thu, 27 Jul 2023 15:31:32 +0800
Subject: [PATCH] docker: remove socket file when get file fd failed
if socket.File() return error, then the socket file will be left over.
---
runtime/v1/shim/client/client.go | 3 +++
1 file changed, 3 insertions(+)
diff --git a/runtime/v1/shim/client/client.go b/runtime/v1/shim/client/client.go
index c5a9bba..4c134c2 100644
--- a/runtime/v1/shim/client/client.go
+++ b/runtime/v1/shim/client/client.go
@@ -71,6 +71,9 @@ func WithStart(binary, address, daemonAddress, cgroup string, debug bool, exitHa
f, err := socket.File()
if err != nil {
+ if err1 := RemoveSocket(address); err1 != nil {
+ logrus.Warningf("failed to remove socket %s: %w", address, err1)
+ }
return nil, nil, errors.Wrapf(err, "failed to get fd for socket %s", address)
}
defer f.Close()
--
2.33.0