changeset 11665:31443b3c5d3b release-3-0-x

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 7fde54a3e0ce
children 93d17b1e756f
files src/ChangeLog src/oct-stream.cc
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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>
 
 	* DLD-FUNCTIONS/rand.cc (do_rand): Pass name of calling function
--- a/src/oct-stream.cc
+++ b/src/oct-stream.cc
@@ -3122,13 +3122,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)
 		    {