mirror of
https://github.com/restic/restic.git
synced 2026-11-28 15:26:48 +00:00
Create uid/gid convertion function.
Create separate function to convert user ID / group ID of a user to integer. Windows is a stub, since this doesn't work on Windows (uid/gid is not a number).
This commit is contained in:
1 parent
0e7d0d8dba
commit
e1f6bbac9f
4 files changed
+39
-20
No files matched your search
+3
-10
@@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/restic/restic/backend"
|
||||
@@ -76,15 +75,9 @@ func (sn *Snapshot) fillUserInfo() error {
|
||||
}
|
||||
sn.Username = usr.Username
|
||||
|
||||
// We ignore the error. On Windows Uid is not a number
|
||||
uid, _ := strconv.ParseInt(usr.Uid, 10, 32)
|
||||
sn.UID = uint32(uid)
|
||||
|
||||
// We ignore the error. On Windows Gid is not a number
|
||||
gid, _ := strconv.ParseInt(usr.Gid, 10, 32)
|
||||
sn.GID = uint32(gid)
|
||||
|
||||
return nil
|
||||
// set userid and groupid
|
||||
sn.UID, sn.GID, err = uidGidInt(*usr)
|
||||
return err
|
||||
}
|
||||
|
||||
// FindSnapshot takes a string and tries to find a snapshot whose ID matches
|
||||
|
||||
Reference in new issue
Block a user