From b2b2305fac0ac5f8363fc308cdebb048ef27522e Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 17 Aug 2017 14:48:11 +0300 Subject: [PATCH] daemon.setMounts(): copy slice in place It does not make sense to copy a slice element by element, then discard the source one. Let's do copy in place instead which is way more efficient. Signed-off-by: Kir Kolyshkin Upstream-commit: d4c94e83ca58b5ffd99840a8e3cbf22f1ab331c0 Component: engine --- components/engine/daemon/oci_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/daemon/oci_linux.go b/components/engine/daemon/oci_linux.go index 62e7c7f1d6..4d891c1f17 100644 --- a/components/engine/daemon/oci_linux.go +++ b/components/engine/daemon/oci_linux.go @@ -533,7 +533,7 @@ func setMounts(daemon *Daemon, s *specs.Spec, c *container.Container, mounts []c // - /dev/shm, in case IpcMode is none. // While at it, also // - set size for /dev/shm from shmsize. - var defaultMounts []specs.Mount + defaultMounts := s.Mounts[:0] _, mountDev := userMounts["/dev"] for _, m := range s.Mounts { if _, ok := userMounts[m.Destination]; ok {