# HG changeset patch # User John W. Eaton # Date 1314202740 14400 # Node ID 7aafa7a2edad72ab6e60986f4ee556184e1eb90e # Parent 7872afb42fab9501c6603f2e86f51b08896e978a sscanf: correctly set output position when reading stops at end of string * file-io.cc (Fsscanf): Set POS output to string length if reading stops at end of string. diff --git a/src/file-io.cc b/src/file-io.cc --- a/src/file-io.cc +++ b/src/file-io.cc @@ -1247,7 +1247,8 @@ // position will clear it. std::string errmsg = os.error (); - retval(3) = os.tell () + 1; + retval(3) + = (os.eof () ? data.length () : os.tell ()) + 1; retval(2) = errmsg; retval(1) = count; retval(0) = tmp;