GNU C Library master sources branch master updated. glibc-2.22-450-g1ee1218

jsm28@sourceware.org jsm28@sourceware.org
Wed Oct 21 23:37:00 GMT 2015


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  1ee1218e3f9b6eda8bc07303027158a4f660fdab (commit)
      from  11074243315907946784af0e4af8541b5c505a02 (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://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1ee1218e3f9b6eda8bc07303027158a4f660fdab

commit 1ee1218e3f9b6eda8bc07303027158a4f660fdab
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Oct 21 23:37:02 2015 +0000

    Move io/tst-fcntl temporary file creation to do_prepare.
    
    This patch makes the io/tst-fcntl test create its temporary file in
    do_prepare not do_test, so that add_temp_name is called in the parent
    on the correct file name, as requested in the thread starting at
    <https://sourceware.org/ml/libc-alpha/2015-10/msg00552.html>.  I don't
    see any reason in this test that opening the file in the parent should
    be problematic.
    
    This patch is explicitly not exhaustive for such issues; other tests
    still call add_temp_file in the child.  The general issue is noted at
    <https://sourceware.org/glibc/wiki/Development_Todo/Master#Use_test-skeleton.c>.
    
    Tested for x86_64 (that this test still passes and no longer leaves a
    file behind in /tmp).
    
    	* io/tst-fcntl.c (fd): New static variable.
    	(do_prepare): Open temporary file here....
    	(do_test): ...not here.

diff --git a/ChangeLog b/ChangeLog
index 66a0cce..015f564 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-10-21  Joseph Myers  <joseph@codesourcery.com>
 
+	* io/tst-fcntl.c (fd): New static variable.
+	(do_prepare): Open temporary file here....
+	(do_test): ...not here.
+
 	* io/ftwtest-sh: Also trap on exit to remove temporary files.
 
 2015-10-21  H.J. Lu  <hongjiu.lu@intel.com>
diff --git a/io/tst-fcntl.c b/io/tst-fcntl.c
index dfdb42e..8814b17 100644
--- a/io/tst-fcntl.c
+++ b/io/tst-fcntl.c
@@ -38,6 +38,9 @@ extern int do_test (int argc, char *argv[]);
 /* Name of the temporary files.  */
 static char *name;
 
+/* File descriptor to temporary file.  */
+static int fd;
+
 void
 do_prepare (int argc, char *argv[])
 {
@@ -47,6 +50,13 @@ do_prepare (int argc, char *argv[])
    name = malloc (name_len + sizeof ("/fcntlXXXXXX"));
    mempcpy (mempcpy (name, test_dir, name_len),
 	    "/fcntlXXXXXX", sizeof ("/fcntlXXXXXX"));
+  /* Create the temporary file.  */
+  fd = mkstemp (name);
+  if (fd == -1)
+    {
+      printf ("cannot open temporary file: %m\n");
+      exit (1);
+    }
    add_temp_file (name);
 }
 
@@ -54,20 +64,12 @@ do_prepare (int argc, char *argv[])
 int
 do_test (int argc, char *argv[])
 {
-  int fd;
   int fd2;
   int fd3;
   struct stat64 st;
   int val;
   int result = 0;
 
-  /* Create the temporary file.  */
-  fd = mkstemp (name);
-  if (fd == -1)
-    {
-      printf ("cannot open temporary file: %m\n");
-      return 1;
-    }
   if (fstat64 (fd, &st) != 0)
     {
       printf ("cannot stat test file: %m\n");

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

Summary of changes:
 ChangeLog      |    4 ++++
 io/tst-fcntl.c |   18 ++++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)


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



More information about the Glibc-cvs mailing list