summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--io/test-lfs.c2
-rw-r--r--login/tst-utmp.c2
-rw-r--r--rt/tst-aio.c2
-rw-r--r--rt/tst-aio64.c2
5 files changed, 12 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 917c4649d9..9465483f83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-10-15  Joseph Myers  <joseph@codesourcery.com>
+
+	* io/test-lfs.c (do_prepare): Do not call add_temp_file until
+	after mkstemp64.
+	* login/tst-utmp.c (do_prepare): Likewise.
+	* rt/tst-aio.c (do_prepare): Likewise.
+	* rt/tst-aio64.c (do_prepare): Likewise.
+
 2015-10-15  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
 	* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
diff --git a/io/test-lfs.c b/io/test-lfs.c
index b6ebae403c..09310a499e 100644
--- a/io/test-lfs.c
+++ b/io/test-lfs.c
@@ -56,7 +56,6 @@ do_prepare (int argc, char *argv[])
   name = malloc (name_len + sizeof ("/lfsXXXXXX"));
   mempcpy (mempcpy (name, test_dir, name_len),
            "/lfsXXXXXX", sizeof ("/lfsXXXXXX"));
-  add_temp_file (name);
 
   /* Open our test file.   */
   fd = mkstemp64 (name);
@@ -71,6 +70,7 @@ do_prepare (int argc, char *argv[])
       else
 	error (EXIT_FAILURE, errno, "cannot create temporary file");
     }
+  add_temp_file (name);
 
   if (getrlimit64 (RLIMIT_FSIZE, &rlim) != 0)
     {
diff --git a/login/tst-utmp.c b/login/tst-utmp.c
index a69a556de5..a02900393f 100644
--- a/login/tst-utmp.c
+++ b/login/tst-utmp.c
@@ -65,12 +65,12 @@ do_prepare (int argc, char *argv[])
   name = malloc (name_len + sizeof ("/utmpXXXXXX"));
   mempcpy (mempcpy (name, test_dir, name_len),
 	   "/utmpXXXXXX", sizeof ("/utmpXXXXXX"));
-  add_temp_file (name);
 
   /* Open our test file.  */
   fd = mkstemp (name);
   if (fd == -1)
     error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+  add_temp_file (name);
 }
 
 struct utmp entry[] =
diff --git a/rt/tst-aio.c b/rt/tst-aio.c
index 783907ea80..007ef6c68f 100644
--- a/rt/tst-aio.c
+++ b/rt/tst-aio.c
@@ -54,12 +54,12 @@ do_prepare (int argc, char *argv[])
   name = malloc (name_len + sizeof ("/aioXXXXXX"));
   mempcpy (mempcpy (name, test_dir, name_len),
 	   "/aioXXXXXX", sizeof ("/aioXXXXXX"));
-  add_temp_file (name);
 
   /* Open our test file.   */
   fd = mkstemp (name);
   if (fd == -1)
     error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+  add_temp_file (name);
 }
 
 
diff --git a/rt/tst-aio64.c b/rt/tst-aio64.c
index 3a9ae797b1..b315eec727 100644
--- a/rt/tst-aio64.c
+++ b/rt/tst-aio64.c
@@ -55,12 +55,12 @@ do_prepare (int argc, char *argv[])
   name = malloc (name_len + sizeof ("/aioXXXXXX"));
   mempcpy (mempcpy (name, test_dir, name_len),
 	   "/aioXXXXXX", sizeof ("/aioXXXXXX"));
-  add_temp_file (name);
 
   /* Open our test file.   */
   fd = mkstemp (name);
   if (fd == -1)
     error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+  add_temp_file (name);
 }