gofrontend: correct file reading logic in Stream_from_file
authorNikhil Benesch <nikhil.benesch@gmail.com>
Sun, 4 Oct 2020 06:03:36 +0000 (02:03 -0400)
committerIan Lance Taylor <iant@golang.org>
Tue, 6 Oct 2020 00:37:32 +0000 (17:37 -0700)
commit7164745e1c21ae85c52b727d61092ad0685b46e9
tree7bdec0e840d3a7868cb172b7725a2689e434a1f5
parent7e9282ae62f5318686dcd58498337090531cd6fc
gofrontend: correct file reading logic in Stream_from_file

The implementation of Stream_from_file mishandled several cases:

  * It reversed the check for whether bytes were already available in
    the peek buffer.

  * It considered positive return values from lseek to be an error, when
    only a -1 return value indicates an error.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/259437
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/import.cc