mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
ba1725a94e
Signed-off-by: John Howard <jhoward@microsoft.com>
24 lines
473 B
Go
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()))
|
|
}
|