Mercurial > octave
changeset 31503:2a12350f9410
scanf: Do cleanup actions before throwing an error.
* libinterp/corefcn/oct-stream.cc (base_stream::do_scanf): Reset failbit on
stream *before* throwing an error.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 22 Nov 2022 12:48:29 +0100 |
parents | b39bf92a2364 |
children | d006285b7509 |
files | libinterp/corefcn/oct-stream.cc |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/oct-stream.cc Tue Nov 22 12:45:48 2022 +0100 +++ b/libinterp/corefcn/oct-stream.cc Tue Nov 22 12:48:29 2022 +0100 @@ -5071,8 +5071,8 @@ // reset the failbit in the stream state. if (is.rdstate () & std::ios::failbit) { + is.clear (is.rdstate () & (~std::ios::failbit)); error (who, "format failed to match"); - is.clear (is.rdstate () & (~std::ios::failbit)); } // FIXME: is this the right thing to do?