2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-05 04:47:51 +00:00
restic/lock_unix.go

25 lines
392 B
Go
Raw Normal View History

// +build !windows
package restic
import (
"os/user"
"strconv"
)
// uidGidInt returns uid, gid of the user as a number.
func uidGidInt(u user.User) (uid, gid uint32, err error) {
2015-08-16 11:36:21 +00:00
var ui, gi int64
ui, err = strconv.ParseInt(u.Uid, 10, 32)
if err != nil {
return
}
gi, err = strconv.ParseInt(u.Gid, 10, 32)
if err != nil {
return
}
uid = uint32(ui)
gid = uint32(gi)
return
}