summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-18 23:05:23 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-18 23:05:23 +0000
commit310f95183a026af2d7854f830b185116aa770852 (patch)
tree9751c39191ff0e39e277afe15f66e4682073bd9d
parente62ee1e44e4d60562ba2b7d7a2ff0556c46df2b2 (diff)
downloadglibc-310f95183a026af2d7854f830b185116aa770852.tar.gz
glibc-310f95183a026af2d7854f830b185116aa770852.tar.xz
glibc-310f95183a026af2d7854f830b185116aa770852.zip
Update.
	* libio/fileops.c (_IO_file_xsgetn): Allocate buffer if none is
	allocated so far.  [PR libc/1261].
-rw-r--r--ChangeLog3
-rw-r--r--libio/fileops.c11
2 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index eb67f1d58a..caa5a5a47a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 1999-08-18  Ulrich Drepper  <drepper@cygnus.com>
 
+	* libio/fileops.c (_IO_file_xsgetn): Allocate buffer if none is
+	allocated so far.  [PR libc/1261].
+
 	* math/libm-test.c (j0_test): Adjust deltas for m68k.
 	(jn_test): Likewise.
 
diff --git a/libio/fileops.c b/libio/fileops.c
index decb9d7185..7c6e271495 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -849,6 +849,17 @@ _IO_file_xsgetn (fp, data, n)
 
   want = n;
 
+  if (fp->_IO_buf_base == NULL)
+    {
+      /* Maybe we already have a push back pointer.  */
+      if (fp->_IO_save_base != NULL)
+	{
+	  free (fp->_IO_save_base);
+	  fp->_flags &= ~_IO_IN_BACKUP;
+	}
+      _IO_doallocbuf (fp);
+    }
+
   while (want > 0)
     {
       have = fp->_IO_read_end - fp->_IO_read_ptr;