* Checks access mode bits against file stats. * @param {string} path The path (for error messages) * @param {Stats} stats The file stats * @param {number} mode The requested access mode
(path, stats, mode)
| 470 | * @param {number} mode The requested access mode |
| 471 | */ |
| 472 | #checkAccessMode(path, stats, mode) { |
| 473 | if (mode == null || mode === 0) return; // F_OK = 0, existence-only check |
| 474 | |
| 475 | const fileMode = stats.mode & 0o777; // Permission bits |
| 476 | // Check owner permissions (simplified: treat VFS user as owner) |
| 477 | if ((mode & R_OK) !== 0 && (fileMode & 0o400) === 0) { |
| 478 | throw createEACCES('access', path); |
| 479 | } |
| 480 | if ((mode & W_OK) !== 0 && (fileMode & 0o200) === 0) { |
| 481 | throw createEACCES('access', path); |
| 482 | } |
| 483 | if ((mode & X_OK) !== 0 && (fileMode & 0o100) === 0) { |
| 484 | throw createEACCES('access', path); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | // === HARD LINK OPERATIONS (optional) === |
| 489 |
no test coverage detected