]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
libio/tst-fopenloc: Use xsetlocale, xfopen, and xfclose
authorArjun Shankar <arjun@redhat.com>
Mon, 11 Nov 2019 14:21:55 +0000 (15:21 +0100)
committerArjun Shankar <ashankar@redhat.com>
Mon, 11 Nov 2019 16:40:46 +0000 (17:40 +0100)
libio/tst-fopenloc.c

index e9548c57ac91590b1571891e6535f7769387daba..797540da0436f977612e587449bfd9e5123c6965 100644 (file)
 #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>