* Changes the permissions on a symbolic link. * @param {string | Buffer | URL} path * @param {number} mode * @param {(err?: Error) => any} callback * @returns {void}
(path, mode, callback)
| 2388 | * @returns {void} |
| 2389 | */ |
| 2390 | function lchmod(path, mode, callback) { |
| 2391 | validateFunction(callback, 'cb'); |
| 2392 | mode = parseFileMode(mode, 'mode'); |
| 2393 | |
| 2394 | const h = vfsState.handlers; |
| 2395 | if (h !== null && vfsVoid(h.lchmod(path, mode), callback)) return; |
| 2396 | |
| 2397 | fs.open(path, O_WRONLY | O_SYMLINK, (err, fd) => { |
| 2398 | if (err) { |
| 2399 | callback(err); |
| 2400 | return; |
| 2401 | } |
| 2402 | // Prefer to return the chmod error, if one occurs, |
| 2403 | // but still try to close, and report closing errors if they occur. |
| 2404 | fs.fchmod(fd, mode, (err) => { |
| 2405 | fs.close(fd, (err2) => { |
| 2406 | callback(aggregateTwoErrors(err2, err)); |
| 2407 | }); |
| 2408 | }); |
| 2409 | }); |
| 2410 | } |
| 2411 | |
| 2412 | /** |
| 2413 | * Synchronously changes the permissions on a symbolic link. |
no test coverage detected
searching dependent graphs…