1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/volumes_linux.go
John Howard ba1725a94e Windows: Refactor volumes
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-04-27 09:27:15 -07:00

24 lines
473 B
Go

// +build !windows
package daemon
import (
"os"
"github.com/docker/docker/pkg/system"
)
// copyOwnership copies the permissions and uid:gid of the source file
// into the destination file
func copyOwnership(source, destination string) error {
stat, err := system.Stat(source)
if err != nil {
return err
}
if err := os.Chown(destination, int(stat.Uid()), int(stat.Gid())); err != nil {
return err
}
return os.Chmod(destination, os.FileMode(stat.Mode()))
}