Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9db924bfebb0
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3a58519a01f2
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on May 24, 2016

  1. Copy the full SHA
    1577a78 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    18d3e4e View commit details
  3. Copy the full SHA
    3a58519 View commit details
Showing with 8 additions and 10 deletions.
  1. +0 −4 spec/truffle/tags/core/io/reopen_tags.txt
  2. +8 −6 truffle/src/main/java/org/jruby/truffle/core/rubinius/IOPrimitiveNodes.java
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/io/reopen_tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
fails:IO#reopen with a String effects exec/system/fork performed after it
fails:IO#reopen with a String opens a path after writing to the original file descriptor
fails:IO#reopen with a String positions an instance that has been read from at the beginning of the new stream
slow:IO#reopen with a String effects exec/system/fork performed after it
slow:IO#reopen with a String affects exec/system/fork performed after it
fails:IO#reopen with a String affects exec/system/fork performed after it
Original file line number Diff line number Diff line change
@@ -338,29 +338,31 @@ public IOReopenPathPrimitiveNode(RubyContext context, SourceSection sourceSectio

@TruffleBoundary(throwsControlFlowException = true)
public void performReopenPath(DynamicObject self, DynamicObject path, int mode) {
int fdSelf = Layouts.IO.getDescriptor(self);
final int fdSelf = Layouts.IO.getDescriptor(self);
final int newFdSelf;
final String targetPathString = StringOperations.getString(getContext(), path);

int fdTarget = ensureSuccessful(posix().open(targetPathString, mode, 666));
int fdTarget = ensureSuccessful(posix().open(targetPathString, mode, 0_666));

final int result = posix().dup2(fdTarget, fdSelf);
if (result == -1) {
final int errno = posix().errno();
if (errno == Errno.EBADF.intValue()) {
Layouts.IO.setDescriptor(self, fdTarget);
fdSelf = fdTarget;
newFdSelf = fdTarget;
} else {
if (fdTarget > 0) {
ensureSuccessful(posix().close(fdTarget));
}
ensureSuccessful(result, errno);
ensureSuccessful(result, errno); // throws
return;
}

} else {
ensureSuccessful(posix().close(fdTarget));
newFdSelf = fdSelf;
}

final int newSelfMode = ensureSuccessful(posix().fcntl(fdSelf, Fcntl.F_GETFL));
final int newSelfMode = ensureSuccessful(posix().fcntl(newFdSelf, Fcntl.F_GETFL));
Layouts.IO.setMode(self, newSelfMode);
}