From 66f64ce2f18d1051f19f342c8fcf98c5066f00a6 Mon Sep 17 00:00:00 2001
From: zhongjiawei <zhongjiawei1@huawei.com>
Date: Mon, 13 Jan 2025 16:35:53 +0800
Subject: [PATCH] docker:check containerd.sock legality

---
 components/engine/cmd/dockerd/daemon.go | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/components/engine/cmd/dockerd/daemon.go b/components/engine/cmd/dockerd/daemon.go
index 89fa9245a..f703765be 100644
--- a/components/engine/cmd/dockerd/daemon.go
+++ b/components/engine/cmd/dockerd/daemon.go
@@ -759,8 +759,11 @@ func validateAuthzPlugins(requestedPlugins []string, pg plugingetter.PluginGette
 }
 
 func systemContainerdRunning() bool {
-	_, err := os.Lstat(containerddefaults.DefaultAddress)
-	return err == nil
+	fileInfo, err := os.Stat(containerddefaults.DefaultAddress)
+	if err != nil {
+		return false
+	}
+	return fileInfo.Mode()&os.ModeSocket == os.ModeSocket
 }
 
 func (cli *DaemonCli) setRuntimeStartTimeout() error {
-- 
2.33.0

