fix: Support GID and UID on Windows

This commit is contained in:
Felicitas Pojtinger
2021-12-24 17:05:05 +01:00
parent 087630710c
commit 8b09fd444f

View File

@@ -82,12 +82,22 @@ func (f *FileSystem) mknode(dir bool, name string, perm os.FileMode) error {
uid, err := strconv.Atoi(usr.Uid)
if err != nil {
return err
// Some OSes like i.e. Windows don't support numeric UIDs, so use 0 instead
if err == strconv.ErrSyntax {
uid = 0
} else {
return err
}
}
gid, err := strconv.Atoi(usr.Gid)
if err != nil {
return err
// Some OSes like i.e. Windows don't support numeric GIDs, so use 0 instead
if err == strconv.ErrSyntax {
gid = 0
} else {
return err
}
}
groups, err := usr.GroupIds()