Skip to content

Commit

Permalink
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -557,6 +557,16 @@ public DynamicObject sysread(VirtualFrame frame, DynamicObject file, int length)
getContext().getSafepointManager().poll(this);

final int readIteration = posix().read(fd, buffer, toRead);

if (readIteration == -1) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().errnoError(posix().errno(), this));
}

if (readIteration == 0) {
return nil();
}

buffer.position(readIteration);
toRead -= readIteration;
}

0 comments on commit a786ac3

Please sign in to comment.