about summary refs log tree commit diff
path: root/libio/ioseekoff.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-09 08:50:50 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-09 08:50:50 +0000
commit40a982a9e1b825b175be7bc7c7199c6bdf363e4b (patch)
tree7523a21da3e35bed6e56133efbe1d16dadb6e6da /libio/ioseekoff.c
parent0f78390bd799fc0b0394240a9a704591481ac8c6 (diff)
downloadglibc-40a982a9e1b825b175be7bc7c7199c6bdf363e4b.tar.gz
glibc-40a982a9e1b825b175be7bc7c7199c6bdf363e4b.tar.xz
glibc-40a982a9e1b825b175be7bc7c7199c6bdf363e4b.zip
Update.
2001-08-09  Ulrich Drepper  <drepper@redhat.com>

	* libio/wfileops.c (_IO_wfile_seekoff): Don't even try to handle
	seeking with backup buffer present.
	Correct determining of internal buffer position.
	Reset also wide buffers if we reset the internal buffers.
	* libio/iofwide.c (_IO_fwide): Always determine file offset for wide
	streams.
	* libio/ioseekoff.c: Catch one unimplemented case.
	* libio/ftello.c: Don't abort if the wide stream has backup buffer.
	* libio/ftello64.c: Likewise.
	* libio/iofgetpos.c: Likewise.
	* libio/iofgetpos64.c: Likewise.
	* libio/ftell.c: Likewise.
	* libio/Makefile (tests): Add tst-ungetwc2.
	* libio/tst-ungetwc2.c: New file.
Diffstat (limited to 'libio/ioseekoff.c')
-rw-r--r--libio/ioseekoff.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libio/ioseekoff.c b/libio/ioseekoff.c
index 60249694c0..2111bec745 100644
--- a/libio/ioseekoff.c
+++ b/libio/ioseekoff.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,6 +25,7 @@
    This exception applies to code released by its copyright holders
    in files containing the exception.  */
 
+#include <stdlib.h>
 #include <libioP.h>
 #include <errno.h>
 #ifndef errno
@@ -58,7 +59,12 @@ _IO_seekoff (fp, offset, dir, mode)
   if (mode != 0 && _IO_have_backup (fp))
     {
       if (dir == _IO_seek_cur && _IO_in_backup (fp))
-	offset -= fp->_IO_read_end - fp->_IO_read_ptr;
+	{
+	  if (fp->_vtable_offset != 0 || fp->_mode <= 0)
+	    offset -= fp->_IO_read_end - fp->_IO_read_ptr;
+	  else
+	    abort ();
+	}
       _IO_free_backup_area (fp);
     }