moby/utils/utils_daemon.go
Rik Nijessen 1ec2eac50d Make utils_daemon and volumes cross-platform compileable.
Signed-off-by: Rik Nijessen <riknijessen@gmail.com>
2015-03-16 11:46:07 +01:00

18 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
}