Skip to content

Commit

Permalink
Stats.hasAccess returns true on symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Nov 21, 2024
1 parent 5340be6 commit 6a29a3e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,7 @@ export abstract class StatsCommon<T extends number | bigint> implements Node.Sta
* @internal
*/
public hasAccess(mode: number): boolean {
if (credentials.euid === 0 || credentials.egid === 0) {
// Running as root
return true;
}
if (this.isSymbolicLink() || credentials.euid === 0 || credentials.egid === 0) return true;

let perm = 0;

Expand Down

0 comments on commit 6a29a3e

Please sign in to comment.