forked from TrueCloudLab/restic
Make UID/GID '0' on Windows.
We ignore parser errors on Uid/Gid, since they are not numbers on Windows. UID/GID is usually 'root' on Linux, so I am not sure if 0/0 is a good idea. Maybe if the type of the fields were changed from uint32 to int, we could set it to -1 to indicate "no value".
This commit is contained in:
parent
4dc746dac2
commit
2e7b40baca
1 changed files with 4 additions and 8 deletions
12
snapshot.go
12
snapshot.go
|
@ -76,16 +76,12 @@ func (sn *Snapshot) fillUserInfo() error {
|
|||
}
|
||||
sn.Username = usr.Username
|
||||
|
||||
uid, err := strconv.ParseInt(usr.Uid, 10, 32)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// We ignore the error. On Windows Uid is not a number
|
||||
uid, _ := strconv.ParseInt(usr.Uid, 10, 32)
|
||||
sn.UID = uint32(uid)
|
||||
|
||||
gid, err := strconv.ParseInt(usr.Gid, 10, 32)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// We ignore the error. On Windows Gid is not a number
|
||||
gid, _ := strconv.ParseInt(usr.Gid, 10, 32)
|
||||
sn.GID = uint32(gid)
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue