about summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-07-22 22:25:20 +0000
committerUlrich Drepper <drepper@redhat.com>2002-07-22 22:25:20 +0000
commit3fa3d0b25c5006fdc19d364b2e1c9316a3b1ceb4 (patch)
tree3b0d6d9f17db5ae477f1ef0737d8c61fb4555081 /libio
parent10e62564606e5c51d0d3426d1f26ad4aaa34b70a (diff)
downloadglibc-3fa3d0b25c5006fdc19d364b2e1c9316a3b1ceb4.tar.gz
glibc-3fa3d0b25c5006fdc19d364b2e1c9316a3b1ceb4.tar.xz
glibc-3fa3d0b25c5006fdc19d364b2e1c9316a3b1ceb4.zip
Update.
2002-07-22  Ulrich Drepper  <drepper@redhat.com>

	* libio/bug-rewind.c: Use test skeleton.  Use create_temp_file for
	file creation.
	* test-skeleton.c (create_temp_file): New function.
Diffstat (limited to 'libio')
-rw-r--r--libio/bug-rewind.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/libio/bug-rewind.c b/libio/bug-rewind.c
index 2a30d28e25..52bf38bccc 100644
--- a/libio/bug-rewind.c
+++ b/libio/bug-rewind.c
@@ -5,24 +5,35 @@
 #define	FAILED  3
 
 
-int
-main (void)
+#define TEST_FUNCTION do_test ()
+static int do_test (void);
+#include "../test-skeleton.c"
+
+
+static int
+do_test (void)
 {
   FILE *fptr;
   char arg1;
   char arg2;
-  int ret, ret1, ret2, result, num;
+  int ret1, ret2, result, num;
+  int fd;
+
+  fd = create_temp_file ("wrewind.", NULL);
+  if (fd == -1)
+    return 3;
 
   ret1 = 0;
   ret2 = 0;
 
-  if ((fptr = fopen ("./wrewind.dat", "w+")) == NULL)
+  fptr = fdopen (fd, "w+");
+  if (fptr == NULL)
     {
       printf ("Unable to open file.\n");
       return 1;
     }
 
-  if ((ret = fwprintf (fptr, L"cderf")) <= 0)
+  if (fwprintf (fptr, L"cderf") <= 0)
     {
       printf ("Unable to write to file with fwprintf().\n");
       fclose (fptr);