about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-07-23 00:31:41 +0000
committerUlrich Drepper <drepper@redhat.com>2002-07-23 00:31:41 +0000
commit97887d3553e8d4673bec256e81d35d7c30a11c07 (patch)
treeec0489d6e45eda53a0be30f599f8bd816573c517
parent3fa3d0b25c5006fdc19d364b2e1c9316a3b1ceb4 (diff)
downloadglibc-97887d3553e8d4673bec256e81d35d7c30a11c07.tar.gz
glibc-97887d3553e8d4673bec256e81d35d7c30a11c07.tar.xz
glibc-97887d3553e8d4673bec256e81d35d7c30a11c07.zip
pdate.
	* libio/tst-eof.c: Rewrite to let test-skeleton.c deal with
	creation and removal of the temp file.
-rw-r--r--ChangeLog3
-rw-r--r--libio/tst-eof.c34
2 files changed, 19 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index cbf67edb3a..26ccf33d41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2002-07-22  Ulrich Drepper  <drepper@redhat.com>
 
+	* libio/tst-eof.c: Rewrite to let test-skeleton.c deal with
+	creation and removal of the temp file.
+
 	* libio/bug-rewind.c: Use test skeleton.  Use create_temp_file for
 	file creation.
 	* test-skeleton.c (create_temp_file): New function.
diff --git a/libio/tst-eof.c b/libio/tst-eof.c
index 4c5ec01692..6baa122ce3 100644
--- a/libio/tst-eof.c
+++ b/libio/tst-eof.c
@@ -4,35 +4,33 @@
 #include <unistd.h>
 
 
+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
-do_test (void)
-{
-  char *buf;
-  int fd;
-  FILE *fp;
+int fd;
 
-  buf = (char *) malloc (strlen (test_dir) + sizeof "/tst-eof.XXXXXX");
-  if (buf == NULL)
-    {
-      printf ("cannot allocate memory: %m\n");
-      return 1;
-    }
-  stpcpy (stpcpy (buf, test_dir), "/tst-eof.XXXXXX");
 
-  fd = mkstemp (buf);
+static void
+do_prepare (void)
+{
+  fd = create_temp_file ("tst-eof.", NULL);
   if (fd == -1)
     {
-      printf ("cannot open temporary file: %m\n");
-      return 1;
+      printf ("cannot create temporary file: %m\n");
+      exit (1);
     }
+}
 
-  /* Make sure it gets removed.  */
-  add_temp_file (buf);
+
+static int
+do_test (void)
+{
+  char buf[40];
+  FILE *fp;
 
   if (write (fd, "some string\n", 12) != 12)
     {