about summary refs log tree commit diff
path: root/libio/iofsetpos64.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/iofsetpos64.c')
-rw-r--r--libio/iofsetpos64.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/libio/iofsetpos64.c b/libio/iofsetpos64.c
index 13ce0fb3cb..a70d5e215a 100644
--- a/libio/iofsetpos64.c
+++ b/libio/iofsetpos64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU IO Library.
 
    This library is free software; you can redistribute it and/or
@@ -27,7 +27,7 @@
 #include <errno.h>
 
 int
-_IO_fsetpos64 (fp, posp)
+_IO_new_fsetpos64 (fp, posp)
      _IO_FILE *fp;
      const _IO_fpos64_t *posp;
 {
@@ -36,7 +36,7 @@ _IO_fsetpos64 (fp, posp)
   CHECK_FILE (fp, EOF);
   _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
   _IO_flockfile (fp);
-  if (_IO_seekpos (fp, *posp, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
+  if (_IO_seekpos (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD)
     {
       /* ANSI explicitly requires setting errno to a positive value on
 	 failure.  */
@@ -47,7 +47,13 @@ _IO_fsetpos64 (fp, posp)
       result = EOF;
     }
   else
-    result = 0;
+    {
+      result = 0;
+      if (fp->_mode > 0
+	  && (*fp->_codecvt->__codecvt_do_encoding) (fp->_codecvt) < 0)
+	/* This is a stateful encoding, safe the state.  */
+	fp->_wide_data->_IO_state = posp->__state;
+    }
   _IO_funlockfile (fp);
   _IO_cleanup_region_end (0);
   return result;
@@ -58,5 +64,7 @@ _IO_fsetpos64 (fp, posp)
 }
 
 #ifdef weak_alias
-weak_alias (_IO_fsetpos64, fsetpos64)
+default_symbol_version (_IO_new_fsetpos64, _IO_fsetpos64, GLIBC_2.2);
+strong_alias (_IO_new_fsetpos64, __new_fsetpos64)
+default_symbol_version (__new_fsetpos64, fsetpos64, GLIBC_2.2);
 #endif