Add key migration to daemon

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
Derek McGowan
2015-01-21 16:55:05 -08:00
parent 06af013f8b
commit 007ef161b4
2 changed files with 51 additions and 0 deletions
+10
View File
@@ -37,3 +37,13 @@ func TreeSize(dir string) (size int64, err error) {
})
return
}
// IsFileOwner checks whether the current user is the owner of the given file.
func IsFileOwner(f string) bool {
if fileInfo, err := os.Stat(f); err == nil && fileInfo != nil {
if stat, ok := fileInfo.Sys().(*syscall.Stat_t); ok && int(stat.Uid) == os.Getuid() {
return true
}
}
return false
}