github.com/lafolle/docker@v1.6.0/utils/utils_daemon.go (about)

     1  // +build daemon
     2  
     3  package utils
     4  
     5  import (
     6  	"github.com/docker/docker/pkg/system"
     7  	"os"
     8  )
     9  
    10  // IsFileOwner checks whether the current user is the owner of the given file.
    11  func IsFileOwner(f string) bool {
    12  	if fileInfo, err := system.Stat(f); err == nil && fileInfo != nil {
    13  		if int(fileInfo.Uid()) == os.Getuid() {
    14  			return true
    15  		}
    16  	}
    17  	return false
    18  }