comparison libinterp/corefcn/oct-stream.cc @ 31170:bcd75c07c9e8 stable

scanf: Don't set error when reaching end of stream (bug #62723). * libinterp/corefcn/oct-stream.cc (base_stream::do_scanf): Don't set error when reaching end of stream.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 02 Aug 2022 18:46:24 +0200
parents 014030798d5e
children c90718a28a3c
comparison
equal deleted inserted replaced
31168:5386fd4af64c 31170:bcd75c07c9e8
4994 final_nc = 1; 4994 final_nc = 1;
4995 } 4995 }
4996 4996
4997 // If it looks like we have a matching failure, then 4997 // If it looks like we have a matching failure, then
4998 // reset the failbit in the stream state. 4998 // reset the failbit in the stream state.
4999 if (is.rdstate () & std::ios::failbit) 4999 if (! is.eof () && is.rdstate () & std::ios::failbit)
5000 { 5000 {
5001 error (who, "format failed to match"); 5001 error (who, "format failed to match");
5002 is.clear (is.rdstate () & (~std::ios::failbit)); 5002 is.clear (is.rdstate () & (~std::ios::failbit));
5003 } 5003 }
5004 5004