Skip to content

Commit

Permalink
fix: Make error catch for strconv in UIDs less explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
pojntfx committed Dec 24, 2021
1 parent 8b09fd4 commit 99e6687
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions internal/fs/filesystem.go
Expand Up @@ -83,21 +83,13 @@ func (f *FileSystem) mknode(dir bool, name string, perm os.FileMode) error {
uid, err := strconv.Atoi(usr.Uid)
if err != nil {
// Some OSes like i.e. Windows don't support numeric UIDs, so use 0 instead
if err == strconv.ErrSyntax {
uid = 0
} else {
return err
}
uid = 0
}

gid, err := strconv.Atoi(usr.Gid)
if err != nil {
// Some OSes like i.e. Windows don't support numeric GIDs, so use 0 instead
if err == strconv.ErrSyntax {
gid = 0
} else {
return err
}
gid = 0
}

groups, err := usr.GroupIds()
Expand Down

0 comments on commit 99e6687

Please sign in to comment.