From 8702c7d91257b99714a586e65ee7e47478611ff4 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 16 Sep 2015 17:38:23 -0700 Subject: [PATCH] Fix a bug in the detection of end-of-file. input returns 0 when it reaches the end of the file; other values may indicate merely a short read. --- ml-proto/src/host/main.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ml-proto/src/host/main.ml b/ml-proto/src/host/main.ml index dd505c33d1..33060f86e6 100644 --- a/ml-proto/src/host/main.ml +++ b/ml-proto/src/host/main.ml @@ -12,7 +12,7 @@ let load file = let rec loop () = let len = input f buf 0 size in let source = Bytes.sub_string buf 0 len in - if len < size then source else source ^ loop () + if len == 0 then source else source ^ loop () in let source = loop () in close_in f;