Skip to content

Commit

Permalink
Don't acquire umask (mutexed) when we're not creating a file.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Dec 8, 2014
1 parent a4ead5a commit 7363556
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/src/main/java/org/jruby/RubyFile.java
Expand Up @@ -1255,11 +1255,14 @@ protected void sysopenInternal(String path, ModeFlags modes, int perm) {
protected void sysopenInternal19(String path, int oflags, int perm) {
if (path.startsWith("jar:")) path = path.substring(4);

int umask = getUmaskSafe( getRuntime() );
perm = perm - (perm & umask);

ModeFlags modes = ModeFlags.createModeFlags(oflags);

// umask must be acquired under lock, but only for creating a new file
if (modes.isCreate()) {
int umask = getUmaskSafe(getRuntime());
perm = perm - (perm & umask);
}

ChannelDescriptor descriptor = sysopen(path, modes, perm);
openFile.setMainStream(fdopen(descriptor, modes));
}
Expand Down

0 comments on commit 7363556

Please sign in to comment.