Skip to content

Commit

Permalink
fix chownR, skip invalid symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
et-nik committed May 1, 2023
1 parent ab81cd5 commit 4dc442a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/app/game_server_commands/os_utils_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ func chownR(path string, uid, gid int) error {
}

if info.Mode()&os.ModeSymlink != 0 {
_, err = os.Readlink(name)
symlinkFile, err := os.Readlink(name)
if err != nil {
// Ignore invalid symlink
return nil
}

if _, err = os.Stat(symlinkFile); err != nil {
// Ignore invalid symlink
return nil
}
}

return os.Chown(name, uid, gid)
Expand Down

0 comments on commit 4dc442a

Please sign in to comment.