Skip to content

Commit 6f334f3

Browse files
authored
Merge pull request #419 from usev6/gh1541
Fix eof detection on zero-size files
2 parents 350f4b5 + a6bff16 commit 6f334f3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/vm/jvm/runtime/org/perl6/nqp/io/FileHandle.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public class FileHandle extends SyncHandle implements IIOSeekable, IIOLockable {
1919

2020
FileChannel fc;
2121
FileLock lock;
22-
protected boolean eof = false;
2322

2423
public static OpenOption[] resolveOpenMode(String mode) {
2524
if(mode.length() == 0)
@@ -153,7 +152,7 @@ else if (readBuffer != null && readBuffer.remaining() > 0)
153152
return false;
154153
else {
155154
try {
156-
eof = fc.position() >= fc.size();
155+
eof = fc.size() > 0 && fc.position() >= fc.size();
157156
return eof;
158157
}
159158
catch (Exception e) {

0 commit comments

Comments
 (0)