finki-main
main
|
Last change
on this file since 62b2964 was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
649 bytes
|
| Line | |
|---|
| 1 | 'use strict'
|
|---|
| 2 | module.exports = (mode, isDir, portable) => {
|
|---|
| 3 | mode &= 0o7777
|
|---|
| 4 |
|
|---|
| 5 | // in portable mode, use the minimum reasonable umask
|
|---|
| 6 | // if this system creates files with 0o664 by default
|
|---|
| 7 | // (as some linux distros do), then we'll write the
|
|---|
| 8 | // archive with 0o644 instead. Also, don't ever create
|
|---|
| 9 | // a file that is not readable/writable by the owner.
|
|---|
| 10 | if (portable) {
|
|---|
| 11 | mode = (mode | 0o600) & ~0o22
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | // if dirs are readable, then they should be listable
|
|---|
| 15 | if (isDir) {
|
|---|
| 16 | if (mode & 0o400) {
|
|---|
| 17 | mode |= 0o100
|
|---|
| 18 | }
|
|---|
| 19 | if (mode & 0o40) {
|
|---|
| 20 | mode |= 0o10
|
|---|
| 21 | }
|
|---|
| 22 | if (mode & 0o4) {
|
|---|
| 23 | mode |= 0o1
|
|---|
| 24 | }
|
|---|
| 25 | }
|
|---|
| 26 | return mode
|
|---|
| 27 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.