mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-13 04:49:36 +00:00
kata-runtime: use filepath.Join() to compose file path
Use filepath.Join() will be safer than format string directly. Signed-off-by: bin <bin@hyper.sh>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"sync"
|
||||
@@ -175,7 +176,7 @@ func (s *iostream) Read(data []byte) (n int, err error) {
|
||||
}
|
||||
|
||||
func getConn(namespace, sandboxID string, port uint64) (net.Conn, error) {
|
||||
socketAddr := fmt.Sprintf("/containerd-shim/%s/%s/shim-monitor.sock", namespace, sandboxID)
|
||||
socketAddr := filepath.Join(string(filepath.Separator), "containerd-shim", namespace, sandboxID, "shim-monitor.sock")
|
||||
client, err := kataMonitor.BuildUnixSocketClient(socketAddr, defaultTimeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user