mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
1ec2eac50d
Signed-off-by: Rik Nijessen <riknijessen@gmail.com>
18 lines
352 B
Go
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
|
|
}
|