about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArjun Shankar <arjun@redhat.com>2019-11-11 15:21:55 +0100
committerArjun Shankar <ashankar@redhat.com>2019-11-11 17:40:46 +0100
commitf0f0d79ac3a2ed7b4e2b99ff993027172068446e (patch)
tree2dcd2167c504bbb02a01cfa5c0a7853b510acaa9
parentcce35a50c1de0cec5cd1f6c18979ff6ee3ea1dd1 (diff)
downloadglibc-f0f0d79ac3a2ed7b4e2b99ff993027172068446e.tar.gz
glibc-f0f0d79ac3a2ed7b4e2b99ff993027172068446e.tar.xz
glibc-f0f0d79ac3a2ed7b4e2b99ff993027172068446e.zip
libio/tst-fopenloc: Use xsetlocale, xfopen, and xfclose
-rw-r--r--libio/tst-fopenloc.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/libio/tst-fopenloc.c b/libio/tst-fopenloc.c
index e9548c57ac..797540da04 100644
--- a/libio/tst-fopenloc.c
+++ b/libio/tst-fopenloc.c
@@ -25,14 +25,11 @@
 #include <string.h>
 #include <wchar.h>
 #include <sys/resource.h>
+#include <support/support.h>
+#include <support/xstdio.h>
 
 static const char inputfile[] = "../iconvdata/testdata/ISO-8859-1";
 
-static int do_test(void);
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
-
 static int
 do_bz17916 (void)
 {
@@ -66,14 +63,9 @@ do_test (void)
 
   mtrace ();
 
-  setlocale (LC_ALL, "de_DE.UTF-8");
+  xsetlocale (LC_ALL, "de_DE.UTF-8");
 
-  fp = fopen (inputfile, "r,ccs=ISO-8859-1");
-  if (fp == NULL)
-    {
-      printf ("cannot open \"%s\": %s\n", inputfile, strerror (errno));
-      exit (1);
-    }
+  fp = xfopen (inputfile, "r,ccs=ISO-8859-1");
 
   while (! feof_unlocked (fp))
     {
@@ -85,7 +77,9 @@ do_test (void)
       fputws (buf, stdout);
     }
 
-  fclose (fp);
+  xfclose (fp);
 
   return do_bz17916 ();
 }
+
+#include <support/test-driver.c>