Permalink
Browse files

fs: make mkdir() default to 0777 permissions

Fixes #1999.
  • Loading branch information...
bnoordhuis committed Nov 3, 2011
1 parent 52eaac4 commit 11d68eb3fc3c2f8d377cf8c50f1babb8d1f82d5f
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/fs.js
View
@@ -354,11 +354,11 @@ fs.fsyncSync = function(fd) {
};
fs.mkdir = function(path, mode, callback) {
- binding.mkdir(path, modeNum(mode), callback || noop);
+ binding.mkdir(path, modeNum(mode, 511 /*=0777*/), callback || noop);

This comment has been minimized.

Show comment
Hide comment
@koichik

koichik Nov 3, 2011

modeNum(mode, '0777')?

@koichik

koichik Nov 3, 2011

modeNum(mode, '0777')?

This comment has been minimized.

Show comment
Hide comment
@bnoordhuis

bnoordhuis Nov 3, 2011

Owner

As a natural born optimizer it pains me to do a superfluous parseInt(s, 8) every call...

@bnoordhuis

bnoordhuis Nov 3, 2011

Owner

As a natural born optimizer it pains me to do a superfluous parseInt(s, 8) every call...

This comment has been minimized.

Show comment
Hide comment
@koichik

koichik Nov 3, 2011

I see. Strict mode should get back OctalIntegerLiteral...

@koichik

koichik Nov 3, 2011

I see. Strict mode should get back OctalIntegerLiteral...

This comment has been minimized.

Show comment
Hide comment
@bnoordhuis

bnoordhuis Nov 3, 2011

Owner

I suspect it caters to web developers who've never heard of octal in the first place, then spend days tracking down bugs caused by a stray zero.

I'd rather leave the patch as it is. LGTY?

@bnoordhuis

bnoordhuis Nov 3, 2011

Owner

I suspect it caters to web developers who've never heard of octal in the first place, then spend days tracking down bugs caused by a stray zero.

I'd rather leave the patch as it is. LGTY?

};
fs.mkdirSync = function(path, mode) {
- return binding.mkdir(path, modeNum(mode));
+ return binding.mkdir(path, modeNum(mode, 511 /*=0777*/));
};
fs.sendfile = function(outFd, inFd, inOffset, length, callback) {

0 comments on commit 11d68eb

Please sign in to comment.