Files
docker-cli/components/engine/utils/utils_daemon.go
Rik Nijessen b06c1f22f7 Make utils_daemon and volumes cross-platform compileable.
Signed-off-by: Rik Nijessen <riknijessen@gmail.com>
Upstream-commit: 1ec2eac50db2c98e00a488664625a22bf3757066
Component: engine
2015-03-16 11:46:07 +01:00

19 lines
352 B
Go

// +build daemon
package utils
import (
"github.com/docker/docker/pkg/system"
"os"
)
// IsFileOwner checks whether the current user is the owner of the given file.
func IsFileOwner(f string) bool {
if fileInfo, err := system.Stat(f); err == nil && fileInfo != nil {
if int(fileInfo.Uid()) == os.Getuid() {
return true
}
}
return false
}