changeset 7538:2c4b0cbda85a

oct-stream.cc (do_read): stop reading if seek fails
author John W. Eaton <jwe@octave.org>
date Wed, 27 Feb 2008 22:47:58 -0500
parents a2950622f070
children 3e107d73aeb4
files src/ChangeLog src/oct-stream.cc
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Feb 27 04:33:39 2008 -0500
+++ b/src/ChangeLog	Wed Feb 27 22:47:58 2008 -0500
@@ -1,3 +1,7 @@
+2008-02-27  John W. Eaton  <jwe@octave.org>
+
+	* oct-stream.cc (do_read): Stop reading if seek fails.
+
 2008-02-26  John W. Eaton  <jwe@octave.org>
 
 	* ov-base-int.cc (octave_base_int_helper,
--- a/src/oct-stream.cc	Wed Feb 27 04:33:39 2008 -0500
+++ b/src/oct-stream.cc	Wed Feb 27 22:47:58 2008 -0500
@@ -3139,13 +3139,15 @@
 		  elts_read++;
 		}
 
+	      int seek_status = 0;
+
 	      if (skip != 0 && elts_read == block_size)
 		{
-		  strm.seek (skip, SEEK_CUR);
+		  seek_status = strm.seek (skip, SEEK_CUR);
 		  elts_read = 0;
 		}
 
-	      if (is.eof ())
+	      if (is.eof () || seek_status < 0)
 		{
 		  if (nr > 0)
 		    {