2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-23 11:28:54 +00:00

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:
Klaus Post 2015-08-14 15:50:14 +02:00
parent 4dc746dac2
commit 2e7b40baca

View File

@ -76,16 +76,12 @@ func (sn *Snapshot) fillUserInfo() error {
} }
sn.Username = usr.Username sn.Username = usr.Username
uid, err := strconv.ParseInt(usr.Uid, 10, 32) // We ignore the error. On Windows Uid is not a number
if err != nil { uid, _ := strconv.ParseInt(usr.Uid, 10, 32)
return err
}
sn.UID = uint32(uid) sn.UID = uint32(uid)
gid, err := strconv.ParseInt(usr.Gid, 10, 32) // We ignore the error. On Windows Gid is not a number
if err != nil { gid, _ := strconv.ParseInt(usr.Gid, 10, 32)
return err
}
sn.GID = uint32(gid) sn.GID = uint32(gid)
return nil return nil