From 2e7b40baca102b239108e9505336533f71269c07 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Fri, 14 Aug 2015 15:50:14 +0200 Subject: [PATCH] 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". --- snapshot.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/snapshot.go b/snapshot.go index b1477c316..1693d2b75 100644 --- a/snapshot.go +++ b/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