This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.16-ports-merge-812-geb6cbd2


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  eb6cbd249f4465b01f428057bf6ab61f5f0c07e3 (commit)
      from  f638872ab422a5747b9481a88087cf7d857f048d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=eb6cbd249f4465b01f428057bf6ab61f5f0c07e3

commit eb6cbd249f4465b01f428057bf6ab61f5f0c07e3
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sat Dec 1 13:00:08 2012 -0500

    [BZ #12724] libio: revert partial POSIX 2008 fclose support
    
    In BZ #12724, partial support for POSIX 2008 fclose behavior was added.
    Since it isn't entirely conforming to the spec, some applications are
    known to be breaking in this intermediate state.  So revert the partial
    support until we can get things fully implemented.
    
    This reverts commit fcabc0f8b185f9e0a9289720be5ede6c39b3bf21.
    
    Signed-off-by: Mike Frysinger <vapier@gentoo.org>

diff --git a/ChangeLog b/ChangeLog
index ff6a493..638934b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-12-01  Mike Frysinger  <vapier@gentoo.org>
+
+	* libio/fileops.c (_IO_new_file_close_it): Do not always flush
+	when currently writing and seek to current position when not.
+	* libio/Makefile (tests): Remove bug-fclose1.
+	* libio/bug-fclose1.c: Delete.
+
 2012-12-01  Joseph Myers  <joseph@codesourcery.com>
 
 	* manual/arith.texi (feenableexcept): Fix typo.
diff --git a/libio/Makefile b/libio/Makefile
index 83d90d0..379d5f7 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -59,7 +59,7 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc   \
 	tst-memstream1 tst-memstream2 \
 	tst-wmemstream1 tst-wmemstream2 \
 	bug-memstream1 bug-wmemstream1 \
-	tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos bug-fclose1 tst-fseek \
+	tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
 	tst-fwrite-error
 ifeq (yes,$(build-shared))
 # Add test-fopenloc only if shared library is enabled since it depends on
diff --git a/libio/bug-fclose1.c b/libio/bug-fclose1.c
deleted file mode 100644
index f1e09f5..0000000
--- a/libio/bug-fclose1.c
+++ /dev/null
@@ -1,132 +0,0 @@
-// BZ #12724
-
-static void do_prepare (void);
-#define PREPARE(argc, argv) do_prepare ()
-static int do_test (void);
-#define TEST_FUNCTION do_test()
-#include "../test-skeleton.c"
-
-
-static int fd;
-
-
-static void
-do_prepare (void)
-{
-  fd = create_temp_file ("bug-fclose1.", NULL);
-  if (fd == -1)
-    {
-      printf ("cannot create temporary file: %m\n");
-      exit (1);
-    }
-}
-
-
-static int
-do_test (void)
-{
-  static const char pattern[] = "hello world";
-
-  /* Prepare a seekable file.  */
-  if (write (fd, pattern, sizeof pattern) != sizeof pattern)
-    {
-      printf ("cannot write pattern: %m\n");
-      return 1;
-    }
-  if (lseek (fd, 1, SEEK_SET) != 1)
-    {
-      printf ("cannot seek after write: %m\n");
-      return 1;
-    }
-
-  /* Create an output stream visiting the file; when it is closed, all
-     other file descriptors visiting the file must see the new file
-     position.  */
-  int fd2 = dup (fd);
-  if (fd2 < 0)
-    {
-      printf ("cannot duplicate descriptor for writing: %m\n");
-      return 1;
-    }
-  FILE *f = fdopen (fd2, "w");
-  if (f == NULL)
-    {
-      printf ("first fdopen failed: %m\n");
-      return 1;
-    }
-  if (fputc (pattern[1], f) != pattern[1])
-    {
-      printf ("fputc failed: %m\n");
-      return 1;
-    }
-  if (fclose (f) != 0)
-    {
-      printf ("first fclose failed: %m\n");
-      return 1;
-    }
-  errno = 0;
-  if (lseek (fd2, 0, SEEK_CUR) != -1)
-    {
-      printf ("lseek after fclose after write did not fail\n");
-      return 1;
-    }
-  if (errno != EBADF)
-    {
-      printf ("lseek after fclose after write did not fail with EBADF: %m\n");
-      return 1;
-    }
-  off_t o = lseek (fd, 0, SEEK_CUR);
-  if (o != 2)
-    {
-      printf ("\
-lseek on original descriptor after first fclose returned %ld, expected 2\n",
-	      (long int) o);
-      return 1;
-    }
-
-  /* Likewise for an input stream.  */
-  fd2 = dup (fd);
-  if (fd2 < 0)
-     {
-      printf ("cannot duplicate descriptor for reading: %m\n");
-      return 1;
-    }
-  f = fdopen (fd2, "r");
-   if (f == NULL)
-    {
-      printf ("second fdopen failed: %m\n");
-      return 1;
-    }
-   char c = fgetc (f);
-   if (c != pattern[2])
-     {
-       printf ("getc returned %c, expected %c\n", c, pattern[2]);
-       return 1;
-     }
-  if (fclose (f) != 0)
-    {
-      printf ("second fclose failed: %m\n");
-      return 1;
-    }
-  errno = 0;
-  if (lseek (fd2, 0, SEEK_CUR) != -1)
-    {
-      printf ("lseek after fclose after read did not fail\n");
-      return 1;
-    }
-  if (errno != EBADF)
-    {
-      printf ("lseek after fclose after read did not fail with EBADF: %m\n");
-      return 1;
-    }
-  o = lseek (fd, 0, SEEK_CUR);
-  if (o != 3)
-    {
-      printf ("\
-lseek on original descriptor after second fclose returned %ld, expected 3\n",
-	      (long int) o);
-      return 1;
-    }
-
-  return 0;
-}
diff --git a/libio/fileops.c b/libio/fileops.c
index fb6ac17..09d689d 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -155,21 +155,13 @@ int
 _IO_new_file_close_it (fp)
      _IO_FILE *fp;
 {
+  int write_status;
   if (!_IO_file_is_open (fp))
     return EOF;
 
-  int write_status;
-  if (_IO_in_put_mode (fp))
+  if ((fp->_flags & _IO_NO_WRITES) == 0
+      && (fp->_flags & _IO_CURRENTLY_PUTTING) != 0)
     write_status = _IO_do_flush (fp);
-  else if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
-	   && !_IO_in_backup (fp))
-    {
-      off64_t o = _IO_SEEKOFF (fp, 0, _IO_seek_cur, 0);
-      if (o == WEOF)
-	write_status = EOF;
-      else
-	write_status = _IO_SYSSEEK (fp, o, SEEK_SET) < 0 ? EOF : 0;
-    }
   else
     write_status = 0;
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    7 +++
 libio/Makefile      |    2 +-
 libio/bug-fclose1.c |  132 ---------------------------------------------------
 libio/fileops.c     |   14 +----
 4 files changed, 11 insertions(+), 144 deletions(-)
 delete mode 100644 libio/bug-fclose1.c


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]