summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
Diffstat (limited to 'libio')
-rw-r--r--libio/iofgetpos64.c20
-rw-r--r--libio/stdio.h29
2 files changed, 31 insertions, 18 deletions
diff --git a/libio/iofgetpos64.c b/libio/iofgetpos64.c
index 029556f8cd..be224ca103 100644
--- a/libio/iofgetpos64.c
+++ b/libio/iofgetpos64.c
@@ -37,6 +37,7 @@ _IO_new_fgetpos64 (fp, posp)
 {
 #ifdef _G_LSEEK64
   _IO_off64_t pos;
+  int result = 0;
   CHECK_FILE (fp, EOF);
   _IO_acquire_lock (fp);
   pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
@@ -45,7 +46,6 @@ _IO_new_fgetpos64 (fp, posp)
       if (fp->_mode <= 0)
 	pos -= fp->_IO_save_end - fp->_IO_save_base;
     }
-  _IO_release_lock (fp);
   if (pos == _IO_pos_BAD)
     {
       /* ANSI explicitly requires setting errno to a positive value on
@@ -54,14 +54,18 @@ _IO_new_fgetpos64 (fp, posp)
       if (errno == 0)
 	__set_errno (EIO);
 # endif
-      return EOF;
+      result = EOF;
+    }
+  else
+    {
+      posp->__pos = pos;
+      if (fp->_mode > 0
+	  && (*fp->_codecvt->__codecvt_do_encoding) (fp->_codecvt) < 0)
+	/* This is a stateful encoding, safe the state.  */
+	posp->__state = fp->_wide_data->_IO_state;
     }
-  posp->__pos = pos;
-  if (fp->_mode > 0
-      && (*fp->_codecvt->__codecvt_do_encoding) (fp->_codecvt) < 0)
-    /* This is a stateful encoding, safe the state.  */
-    posp->__state = fp->_wide_data->_IO_state;
-  return 0;
+  _IO_release_lock (fp);
+  return result;
 #else
   __set_errno (ENOSYS);
   return EOF;
diff --git a/libio/stdio.h b/libio/stdio.h
index 88ef61b029..140643911f 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -470,9 +470,12 @@ __BEGIN_NAMESPACE_STD
 /* Write a character to STREAM.
 
    These functions are possible cancellation points and therefore not
+   marked with __THROW.
+
+   These functions is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fputc (int __c, FILE *__stream) __THROW;
-extern int putc (int __c, FILE *__stream) __THROW;
+extern int fputc (int __c, FILE *__stream);
+extern int putc (int __c, FILE *__stream);
 
 /* Write a character to stdout.
 
@@ -508,10 +511,10 @@ extern int putchar_unlocked (int __c);
 #if defined __USE_SVID || defined __USE_MISC \
     || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
 /* Get a word (int) from STREAM.  */
-extern int getw (FILE *__stream) __THROW;
+extern int getw (FILE *__stream);
 
 /* Write a word (int) to STREAM.  */
-extern int putw (int __w, FILE *__stream) __THROW;
+extern int putw (int __w, FILE *__stream);
 #endif
 
 
@@ -626,9 +629,9 @@ extern int fputs_unlocked (__const char *__restrict __s,
    or due to the implementation they are cancellation points and
    therefore not marked with __THROW.  */
 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
-			      size_t __n, FILE *__restrict __stream) __THROW;
+			      size_t __n, FILE *__restrict __stream);
 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
-			       size_t __n, FILE *__restrict __stream) __THROW;
+			       size_t __n, FILE *__restrict __stream);
 #endif
 
 
@@ -757,11 +760,17 @@ extern int fileno_unlocked (FILE *__stream) __THROW;
 
 #if (defined __USE_POSIX2 || defined __USE_SVID  || defined __USE_BSD || \
      defined __USE_MISC)
-/* Create a new stream connected to a pipe running the given command.  */
-extern FILE *popen (__const char *__command, __const char *__modes) __THROW;
+/* Create a new stream connected to a pipe running the given command.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern FILE *popen (__const char *__command, __const char *__modes);
 
-/* Close a stream opened by popen and return the status of its child.  */
-extern int pclose (FILE *__stream) __THROW;
+/* Close a stream opened by popen and return the status of its child.
+
+   This function is a possible cancellation point and therefore not
+   marked with __THROW.  */
+extern int pclose (FILE *__stream);
 #endif