From e37f6db96f63ded68813dd97e0ad109dfe9c5fd2 Mon Sep 17 00:00:00 2001 From: Shukui Yang Date: Mon, 24 Aug 2020 16:05:20 +0800 Subject: [PATCH] Replace syscall.Unlink with os.Remove so that the directory(e.g. /run/docker.sock/) can be deleted Signed-off-by: Shukui Yang Signed-off-by: Shukui Yang --- sockets/unix_socket.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sockets/unix_socket.go b/sockets/unix_socket.go index 1d91c7b6c..0df5f8201 100644 --- a/sockets/unix_socket.go +++ b/sockets/unix_socket.go @@ -79,7 +79,7 @@ func WithChmod(mask os.FileMode) SockOption { // NewUnixSocketWithOpts creates a unix socket with the specified options func NewUnixSocketWithOpts(path string, opts ...SockOption) (net.Listener, error) { - if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) { + if err := os.Remove(path); err != nil && !os.IsNotExist(err) { return nil, err } mask := syscall.Umask(0777)