Skip to content

Commit

Permalink
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/src/main/java/org/jruby/RubyFile.java
Original file line number Diff line number Diff line change
@@ -263,12 +263,13 @@ public IRubyObject flock(ThreadContext context, IRubyObject lockingConstant) {
int lockMode = RubyNumeric.num2int(lockingConstant);

Channel channel = descriptor.getChannel();

FileDescriptor fd = ChannelDescriptor.getDescriptorFromChannel(channel);
int real_fd = JavaLibCHelper.getfdFromDescriptor(fd);

if (real_fd != -1) {
// we have a real fd...try native flocking
if (real_fd != -1 && !Platform.IS_SOLARIS) {
// we have a real fd and not on Solaris...try native flocking
// see jruby/jruby#3254 and jnr/jnr-posix#60
try {
int result = runtime.getPosix().flock(real_fd, lockMode);
if (result < 0) {

0 comments on commit 964fbe4

Please sign in to comment.