diff --git a/glibc-fedora-use-test-skeleton.patch b/glibc-fedora-use-test-skeleton.patch deleted file mode 100644 index ce21e8d..0000000 --- a/glibc-fedora-use-test-skeleton.patch +++ /dev/null @@ -1,2706 +0,0 @@ -diff --git a/catgets/test-gencat.c b/catgets/test-gencat.c -index eaa9b89..282974c 100644 ---- a/catgets/test-gencat.c -+++ b/catgets/test-gencat.c -@@ -3,8 +3,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - nl_catd catalog; - setlocale (LC_ALL, ""); -@@ -29,3 +29,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/catgets/tst-catgets.c b/catgets/tst-catgets.c -index fdaa834..a0a4089 100644 ---- a/catgets/tst-catgets.c -+++ b/catgets/tst-catgets.c -@@ -14,8 +14,8 @@ static const char *msgs[] = - - #define ROUNDS 5 - --int --main (void) -+static int -+do_test (void) - { - int rnd; - int result = 0; -@@ -64,3 +64,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/csu/tst-empty.c b/csu/tst-empty.c -index 980dcd6..e99468e 100644 ---- a/csu/tst-empty.c -+++ b/csu/tst-empty.c -@@ -1,6 +1,9 @@ - /* The most useful C program known to man. */ --int --main (void) -+static int -+do_test (void) - { - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/elf/tst-audit2.c b/elf/tst-audit2.c -index b4fa906..acad1b0 100644 ---- a/elf/tst-audit2.c -+++ b/elf/tst-audit2.c -@@ -31,8 +31,8 @@ calloc (size_t n, size_t m) - return ptr; - } - --int --main (void) -+static int -+do_test (void) - { - if (magic[1] != MAGIC1 || magic[0] != MAGIC2) - { -@@ -42,3 +42,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/elf/tst-global1.c b/elf/tst-global1.c -index 1611b51..4df335c 100644 ---- a/elf/tst-global1.c -+++ b/elf/tst-global1.c -@@ -1,8 +1,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - void *h1 = dlopen ("$ORIGIN/testobj6.so", RTLD_GLOBAL|RTLD_LAZY); - if (h1 == NULL) -@@ -34,3 +34,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/elf/tst-pathopt.c b/elf/tst-pathopt.c -index 1f7aac2..8d73ad4 100644 ---- a/elf/tst-pathopt.c -+++ b/elf/tst-pathopt.c -@@ -4,8 +4,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - void *h; - int (*fp) (int); -@@ -37,3 +37,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/elf/tst-piemod1.c b/elf/tst-piemod1.c -index ad439da..6e98b5f 100644 ---- a/elf/tst-piemod1.c -+++ b/elf/tst-piemod1.c -@@ -6,8 +6,8 @@ foo (void) - return 21; - } - --int --main (void) -+static int -+do_test (void) - { - int val = foo (); - if (val != 34) -@@ -18,3 +18,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/elf/tst-tls10.c b/elf/tst-tls10.c -index 347243f..eb1ecb9 100644 ---- a/elf/tst-tls10.c -+++ b/elf/tst-tls10.c -@@ -8,8 +8,8 @@ __thread struct A local = { 1, 2, 3 }; - if (p->a != S || p->b != S + 1 || p->c != S + 2) \ - abort () - --int --main (void) -+static int -+do_test (void) - { - struct A *p; - if (local.a != 1 || local.b != 2 || local.c != 3) -@@ -35,3 +35,6 @@ main (void) - - exit (0); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/elf/tst-tls11.c b/elf/tst-tls11.c -index 8a2fef4..8ceac14 100644 ---- a/elf/tst-tls11.c -+++ b/elf/tst-tls11.c -@@ -5,8 +5,8 @@ - if (p->a != S || p->b != S + 1 || p->c != S + 2) \ - abort () - --int --main (void) -+static int -+do_test (void) - { - struct A *p; - check1 (); -@@ -24,3 +24,6 @@ main (void) - - exit (0); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/elf/tst-tls12.c b/elf/tst-tls12.c -index 9086d17..8093894 100644 ---- a/elf/tst-tls12.c -+++ b/elf/tst-tls12.c -@@ -5,8 +5,8 @@ - if (p->a != S || p->b != S + 1 || p->c != S + 2) \ - abort () - --int --main (void) -+static int -+do_test (void) - { - struct A *p; - check1 (); -@@ -15,3 +15,6 @@ main (void) - - exit (0); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/gnulib/tst-gcc.c b/gnulib/tst-gcc.c -index 71fab28..9f4ba83 100644 ---- a/gnulib/tst-gcc.c -+++ b/gnulib/tst-gcc.c -@@ -51,8 +51,8 @@ - }) - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - int __integer_type; -@@ -71,3 +71,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/iconv/tst-iconv1.c b/iconv/tst-iconv1.c -index d806ce6..0609f50 100644 ---- a/iconv/tst-iconv1.c -+++ b/iconv/tst-iconv1.c -@@ -5,8 +5,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - char utf8[5]; - wchar_t ucs4[5]; -@@ -42,3 +42,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/iconv/tst-iconv2.c b/iconv/tst-iconv2.c -index 5036ad1..0672a51 100644 ---- a/iconv/tst-iconv2.c -+++ b/iconv/tst-iconv2.c -@@ -25,8 +25,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - char buf[3]; - const wchar_t wc[1] = L"a"; -@@ -97,3 +97,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/iconvdata/tst-e2big.c b/iconvdata/tst-e2big.c -index 9533eb0..8de64b2 100644 ---- a/iconvdata/tst-e2big.c -+++ b/iconvdata/tst-e2big.c -@@ -95,10 +95,13 @@ test_tscii (void) - test ("TSCII", inbuf, sizeof (inbuf), 9); - } - --int --main (void) -+static int -+do_test (void) - { - test_euc_jisx0213 (); - test_tscii (); - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/iconvdata/tst-loading.c b/iconvdata/tst-loading.c -index 0d8a959..eff9d78 100644 ---- a/iconvdata/tst-loading.c -+++ b/iconvdata/tst-loading.c -@@ -114,8 +114,8 @@ static const char inbuf[] = - " function. Later modifications of the variable have no effect.\n"; - - --int --main (void) -+static int -+do_test (void) - { - size_t count = TEST_ROUNDS; - int result = 0; -@@ -180,3 +180,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/inet/test-inet6_opt.c b/inet/test-inet6_opt.c -index 3bf319e..a7ebf00 100644 ---- a/inet/test-inet6_opt.c -+++ b/inet/test-inet6_opt.c -@@ -194,8 +194,8 @@ decode_inet6_opt (void *eb, socklen_t el) - return ret; - } - --int --main (void) -+static int -+do_test (void) - { - void *eb; - socklen_t el; -@@ -206,3 +206,6 @@ main (void) - return 1; - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/inet/tst-gethnm.c b/inet/tst-gethnm.c -index 8af44d6..dd3a547 100644 ---- a/inet/tst-gethnm.c -+++ b/inet/tst-gethnm.c -@@ -10,8 +10,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - struct hostent *ent; - struct in_addr hostaddr; -@@ -62,3 +62,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/inet/tst-network.c b/inet/tst-network.c -index fc90bd7..cc840e0 100644 ---- a/inet/tst-network.c -+++ b/inet/tst-network.c -@@ -51,8 +51,8 @@ struct - }; - - --int --main (void) -+static int -+do_test (void) - { - int errors = 0; - size_t i; -@@ -76,3 +76,6 @@ main (void) - - return errors != 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/inet/tst-ntoa.c b/inet/tst-ntoa.c -index 9be91eb..ef82d4d 100644 ---- a/inet/tst-ntoa.c -+++ b/inet/tst-ntoa.c -@@ -22,8 +22,8 @@ test (unsigned int inaddr, const char *expected) - } - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -34,3 +34,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/intl/tst-codeset.c b/intl/tst-codeset.c -index f5b37ec..37f731e 100644 ---- a/intl/tst-codeset.c -+++ b/intl/tst-codeset.c -@@ -23,8 +23,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - char *s; - int result = 0; -@@ -55,3 +55,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/intl/tst-gettext2.c b/intl/tst-gettext2.c -index 075680a..3c44165 100644 ---- a/intl/tst-gettext2.c -+++ b/intl/tst-gettext2.c -@@ -40,8 +40,8 @@ struct data_t strings[] = - const int lang_cnt = 3; - const char *lang[] = {"lang1", "lang2", "lang3"}; - --int --main (void) -+static int -+do_test (void) - { - int i; - -@@ -70,3 +70,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/intl/tst-gettext3.c b/intl/tst-gettext3.c -index dd88987..11e9b08 100644 ---- a/intl/tst-gettext3.c -+++ b/intl/tst-gettext3.c -@@ -24,8 +24,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - char *s; - int result = 0; -@@ -57,3 +57,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/intl/tst-ngettext.c b/intl/tst-ngettext.c -index 4fb0ca2..71e91b9 100644 ---- a/intl/tst-ngettext.c -+++ b/intl/tst-ngettext.c -@@ -25,8 +25,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - const char *strs[2] = { "singular", "plural" }; - unsigned long int i; -@@ -63,3 +63,6 @@ main (void) - - return res; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/intl/tst-translit.c b/intl/tst-translit.c -index 1aecee7..299fa40 100644 ---- a/intl/tst-translit.c -+++ b/intl/tst-translit.c -@@ -24,8 +24,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - const char *s; -@@ -49,3 +49,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/io/test-stat.c b/io/test-stat.c -index c5cfd26..e9c8468 100644 ---- a/io/test-stat.c -+++ b/io/test-stat.c -@@ -25,8 +25,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - /* With _FILE_OFFSET_BITS=64 struct stat and struct stat64 should - be identical. */ -@@ -65,3 +65,6 @@ main (void) - #endif - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/libio/test-fmemopen.c b/libio/test-fmemopen.c -index 3099894..211176e 100644 ---- a/libio/test-fmemopen.c -+++ b/libio/test-fmemopen.c -@@ -22,8 +22,8 @@ static char buffer[] = "foobar"; - #include - #include - --int --main (void) -+static int -+do_test (void) - { - int ch; - FILE *stream; -@@ -37,3 +37,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/libio/tst-freopen.c b/libio/tst-freopen.c -index f9e7177..94284ec 100644 ---- a/libio/tst-freopen.c -+++ b/libio/tst-freopen.c -@@ -22,8 +22,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - char name[] = "/tmp/tst-freopen.XXXXXX"; - const char * const test = "Let's test freopen.\n"; -@@ -100,3 +100,6 @@ main (void) - unlink (name); - exit (0); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/libio/tst-sscanf.c b/libio/tst-sscanf.c -index b1a2b84..fb4be34 100644 ---- a/libio/tst-sscanf.c -+++ b/libio/tst-sscanf.c -@@ -3,8 +3,8 @@ - - #define WCS_LENGTH 256 - --int --main (void) -+static int -+do_test (void) - { - const char cnv[] ="%l[abc]"; - const char str[] = "abbcXab"; -@@ -18,3 +18,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/libio/tst-ungetwc1.c b/libio/tst-ungetwc1.c -index f74c407..f71b390 100644 ---- a/libio/tst-ungetwc1.c -+++ b/libio/tst-ungetwc1.c -@@ -7,8 +7,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - FILE *fp; - const char *str = "abcdef"; -@@ -79,3 +79,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/libio/tst-ungetwc2.c b/libio/tst-ungetwc2.c -index d15e287..a7c5193 100644 ---- a/libio/tst-ungetwc2.c -+++ b/libio/tst-ungetwc2.c -@@ -7,8 +7,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - FILE *fp; - const char *str = "abcdef"; -@@ -79,3 +79,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/libio/tst-widetext.c b/libio/tst-widetext.c -index 179763e..acab72b 100644 ---- a/libio/tst-widetext.c -+++ b/libio/tst-widetext.c -@@ -31,8 +31,8 @@ - #define SIZE 210000 - - --int --main (void) -+static int -+do_test (void) - { - char name[] = "/tmp/widetext.out.XXXXXX"; - char mbbuf[SIZE]; -@@ -367,3 +367,6 @@ main (void) - - return status; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-ctype.c b/localedata/tst-ctype.c -index ceda891..a4e8fcf 100644 ---- a/localedata/tst-ctype.c -+++ b/localedata/tst-ctype.c -@@ -61,8 +61,8 @@ static struct classes - } - - --int --main (void) -+static int -+do_test (void) - { - const char *cp; - const char *cp2; -@@ -447,3 +447,6 @@ punct = %04x alnum = %04x\n", - printf (" No errors for `%s' locale\n\n\n", setlocale (LC_ALL, NULL)); - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-digits.c b/localedata/tst-digits.c -index 9b3ebcd..76356e9 100644 ---- a/localedata/tst-digits.c -+++ b/localedata/tst-digits.c -@@ -111,8 +111,8 @@ static struct wprintf_int_test - (sizeof (wprintf_int_tests) / sizeof (wprintf_int_tests[0])) - - --int --main (void) -+static int -+do_test (void) - { - int cnt; - int failures; -@@ -246,3 +246,6 @@ main (void) - - return status; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-leaks.c b/localedata/tst-leaks.c -index 7a4b557..ccd44f2 100644 ---- a/localedata/tst-leaks.c -+++ b/localedata/tst-leaks.c -@@ -1,8 +1,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - int cnt; - -@@ -16,3 +16,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-mbswcs1.c b/localedata/tst-mbswcs1.c -index 14f1372..1404829 100644 ---- a/localedata/tst-mbswcs1.c -+++ b/localedata/tst-mbswcs1.c -@@ -33,8 +33,8 @@ - } \ - putc ('\n', stdout) - --int --main (void) -+static int -+do_test (void) - { - const unsigned char buf[6] = { 0x25, 0xe2, 0x82, 0xac, 0xce, 0xbb }; - mbstate_t state; -@@ -60,3 +60,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-mbswcs2.c b/localedata/tst-mbswcs2.c -index 25fa951..9cd95d6 100644 ---- a/localedata/tst-mbswcs2.c -+++ b/localedata/tst-mbswcs2.c -@@ -35,8 +35,8 @@ - } \ - putc ('\n', stdout) - --int --main (void) -+static int -+do_test (void) - { - unsigned char buf[6] = { 0x25, 0xe2, 0x82, 0xac, 0xce, 0xbb }; - mbstate_t state; -@@ -62,3 +62,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-mbswcs3.c b/localedata/tst-mbswcs3.c -index 8db65c5..a068541 100644 ---- a/localedata/tst-mbswcs3.c -+++ b/localedata/tst-mbswcs3.c -@@ -38,8 +38,8 @@ - putc ('\n', stdout); \ - } - --int --main (void) -+static int -+do_test (void) - { - unsigned char buf[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - const unsigned char bufcheck[6] = { 0x25, 0xe2, 0x82, 0xac, 0xce, 0xbb }; -@@ -73,3 +73,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-mbswcs4.c b/localedata/tst-mbswcs4.c -index 09b7417..a4fe60d 100644 ---- a/localedata/tst-mbswcs4.c -+++ b/localedata/tst-mbswcs4.c -@@ -34,8 +34,8 @@ - } \ - putc ('\n', stdout) - --int --main (void) -+static int -+do_test (void) - { - unsigned char buf[6] = { 0x25, 0xe2, 0x82, 0xac, 0xce, 0xbb }; - mbstate_t state; -@@ -60,3 +60,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-mbswcs5.c b/localedata/tst-mbswcs5.c -index e18862c..c44f12a 100644 ---- a/localedata/tst-mbswcs5.c -+++ b/localedata/tst-mbswcs5.c -@@ -37,8 +37,8 @@ - putc ('\n', stdout); \ - } - --int --main (void) -+static int -+do_test (void) - { - unsigned char buf[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - const unsigned char bufcheck[7] = { 0x25, 0xe2, 0x82, 0xac, 0xce, 0xbb, 0 }; -@@ -72,3 +72,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-setlocale.c b/localedata/tst-setlocale.c -index 1f8e68d..a09a4de 100644 ---- a/localedata/tst-setlocale.c -+++ b/localedata/tst-setlocale.c -@@ -3,8 +3,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - char q[30]; - char *s; -@@ -23,3 +23,6 @@ main (void) - - return strcmp (s, "de_DE.UTF-8") != 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-trans.c b/localedata/tst-trans.c -index 5e09631..0b0be83 100644 ---- a/localedata/tst-trans.c -+++ b/localedata/tst-trans.c -@@ -24,8 +24,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - char buf[30]; - wchar_t wbuf[30]; -@@ -68,3 +68,6 @@ main (void) - - return errors; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-wctype.c b/localedata/tst-wctype.c -index bd2b057..eb72030 100644 ---- a/localedata/tst-wctype.c -+++ b/localedata/tst-wctype.c -@@ -24,8 +24,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - wctype_t wct; - wchar_t buf[1000]; -@@ -141,3 +141,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/localedata/tst-xlocale1.c b/localedata/tst-xlocale1.c -index 297c9ad..9f545a0 100644 ---- a/localedata/tst-xlocale1.c -+++ b/localedata/tst-xlocale1.c -@@ -20,8 +20,8 @@ static struct - #define ntests (sizeof (tests) / sizeof (tests[0])) - - --int --main (void) -+static int -+do_test (void) - { - size_t cnt; - int result = 0; -@@ -73,3 +73,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/login/tst-grantpt.c b/login/tst-grantpt.c -index 5078dac..65bb344 100644 ---- a/login/tst-grantpt.c -+++ b/login/tst-grantpt.c -@@ -66,8 +66,8 @@ test_einval (void) - return ret; - } - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -76,3 +76,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/malloc/tst-calloc.c b/malloc/tst-calloc.c -index 51e6c25..7ad5124 100644 ---- a/malloc/tst-calloc.c -+++ b/malloc/tst-calloc.c -@@ -104,8 +104,8 @@ null_test (void) - } - - --int --main (void) -+static int -+do_test (void) - { - /* We are allocating blocks with `calloc' and check whether every - block is completely cleared. We first try this for some fixed -@@ -123,3 +123,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/malloc/tst-malloc.c b/malloc/tst-malloc.c -index a75ab1e..2685315 100644 ---- a/malloc/tst-malloc.c -+++ b/malloc/tst-malloc.c -@@ -29,8 +29,8 @@ merror (const char *msg) - printf ("Error: %s\n", msg); - } - --int --main (void) -+static int -+do_test (void) - { - void *p, *q; - int save; -@@ -75,3 +75,6 @@ main (void) - - return errors != 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/malloc/tst-mallocstate.c b/malloc/tst-mallocstate.c -index 69c4500..539539e 100644 ---- a/malloc/tst-mallocstate.c -+++ b/malloc/tst-mallocstate.c -@@ -29,8 +29,8 @@ merror (const char *msg) - printf ("Error: %s\n", msg); - } - --int --main (void) -+static int -+do_test (void) - { - void *p1, *p2; - void *save_state; -@@ -79,3 +79,6 @@ main (void) - * c-basic-offset: 2 - * End: - */ -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/malloc/tst-mcheck.c b/malloc/tst-mcheck.c -index 478ca8c..bd9ab0e 100644 ---- a/malloc/tst-mcheck.c -+++ b/malloc/tst-mcheck.c -@@ -29,8 +29,8 @@ merror (const char *msg) - printf ("Error: %s\n", msg); - } - --int --main (void) -+static int -+do_test (void) - { - void *p, *q; - -@@ -88,3 +88,6 @@ main (void) - - return errors != 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/malloc/tst-mtrace.c b/malloc/tst-mtrace.c -index 9b5151c..b2c0c2c 100644 ---- a/malloc/tst-mtrace.c -+++ b/malloc/tst-mtrace.c -@@ -30,8 +30,8 @@ static void print (const void *node, VISIT value, int level); - static FILE *fp; - - --int --main (void) -+static int -+do_test (void) - { - void *root = NULL; - size_t linelen = 0; -@@ -100,3 +100,6 @@ print (const void *node, VISIT value, int level) - if (value == postorder || value == leaf) - fprintf (fp, "%3d: %s", ++cnt, *(const char **) node); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/malloc/tst-obstack.c b/malloc/tst-obstack.c -index 769697f..ee1385d 100644 ---- a/malloc/tst-obstack.c -+++ b/malloc/tst-obstack.c -@@ -25,8 +25,8 @@ verbose_free (void *buf) - printf ("free (%p)\n", buf); - } - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - int align = 2; -@@ -62,3 +62,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/math/atest-exp.c b/math/atest-exp.c -index 3a538b2..6a551de 100644 ---- a/math/atest-exp.c -+++ b/math/atest-exp.c -@@ -102,8 +102,8 @@ mpn_bitsize(const mp_limb_t *SRC_PTR, mp_size_t SIZE) - return i * mpbpl + j; - } - --int --main (void) -+static int -+do_test (void) - { - mp1 ex, x, xt, e2, e3; - int i; -@@ -190,3 +190,6 @@ main (void) - - return failures == 0 ? 0 : 1; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/math/atest-exp2.c b/math/atest-exp2.c -index 3442715..945bb7a 100644 ---- a/math/atest-exp2.c -+++ b/math/atest-exp2.c -@@ -144,8 +144,8 @@ mpn_bitsize(const mp_limb_t *SRC_PTR, mp_size_t SIZE) - return i * mpbpl + j; - } - --int --main (void) -+static int -+do_test (void) - { - mp1 ex, x, xt, e2, e3; - int i; -@@ -227,3 +227,6 @@ main (void) - - return failures == 0 ? 0 : 1; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/math/atest-sincos.c b/math/atest-sincos.c -index 5ad59b2..1f5e730 100644 ---- a/math/atest-sincos.c -+++ b/math/atest-sincos.c -@@ -141,8 +141,8 @@ mpn_bitsize (const mp_limb_t *SRC_PTR, mp_size_t SIZE) - return i * mpbpl + j; - } - --int --main (void) -+static int -+do_test (void) - { - mp1 si, co, x, ox, xt, s2, c2, s3, c3; - int i; -@@ -277,3 +277,6 @@ main (void) - - return (sin_failures == 0 && cos_failures == 0) ? 0 : 1; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/math/test-matherr.c b/math/test-matherr.c -index cd09a39..6983879 100644 ---- a/math/test-matherr.c -+++ b/math/test-matherr.c -@@ -12,10 +12,13 @@ matherr (struct exception *s) - return 1; - } - --int --main (void) -+static int -+do_test (void) - { - _LIB_VERSION = _SVID_; - acos (2.0); - return fail; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/math/test-misc.c b/math/test-misc.c -index 3fd2bca..4801bfe 100644 ---- a/math/test-misc.c -+++ b/math/test-misc.c -@@ -25,8 +25,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -1201,3 +1201,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/math/test-powl.c b/math/test-powl.c -index fd2a1cb..66ef886 100644 ---- a/math/test-powl.c -+++ b/math/test-powl.c -@@ -21,8 +21,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -48,3 +48,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/math/tst-definitions.c b/math/tst-definitions.c -index 2501c8c..76a4125 100644 ---- a/math/tst-definitions.c -+++ b/math/tst-definitions.c -@@ -21,8 +21,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -44,3 +44,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/misc/tst-dirname.c b/misc/tst-dirname.c -index d8f33df..d6c05ad 100644 ---- a/misc/tst-dirname.c -+++ b/misc/tst-dirname.c -@@ -37,8 +37,8 @@ test (const char *input, const char *result) - return retval; - } - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -67,3 +67,6 @@ main (void) - - return result != 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/misc/tst-efgcvt.c b/misc/tst-efgcvt.c -index 303042d..11427a0 100644 ---- a/misc/tst-efgcvt.c -+++ b/misc/tst-efgcvt.c -@@ -200,8 +200,8 @@ special (void) - } - - --int --main (void) -+static int -+do_test (void) - { - test (ecvt_tests, ecvt, "ecvt"); - test (fcvt_tests, fcvt, "fcvt"); -@@ -211,3 +211,6 @@ main (void) - - return error_count; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/misc/tst-fdset.c b/misc/tst-fdset.c -index 78a34e9..ef93ac3 100644 ---- a/misc/tst-fdset.c -+++ b/misc/tst-fdset.c -@@ -20,8 +20,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - int retval = 0; - int i; -@@ -62,3 +62,6 @@ main (void) - - return retval; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/misc/tst-hsearch.c b/misc/tst-hsearch.c -index 6c19b22..d390f1d 100644 ---- a/misc/tst-hsearch.c -+++ b/misc/tst-hsearch.c -@@ -1,8 +1,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - int a = 1; - int b = 2; -@@ -29,3 +29,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/misc/tst-mntent2.c b/misc/tst-mntent2.c -index 6c25e01..e61d506 100644 ---- a/misc/tst-mntent2.c -+++ b/misc/tst-mntent2.c -@@ -3,8 +3,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - struct mntent mef; -@@ -39,3 +39,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/nptl/tst-sem7.c b/nptl/tst-sem7.c -index d0e7f05..4fc5f1f 100644 ---- a/nptl/tst-sem7.c -+++ b/nptl/tst-sem7.c -@@ -31,8 +31,8 @@ remove_sem (int status, void *arg) - } - - --int --main (void) -+static int -+do_test (void) - { - sem_t *s; - sem_t *s2; -@@ -106,3 +106,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/nptl/tst-sem8.c b/nptl/tst-sem8.c -index 1aeb1e1..4d7197c 100644 ---- a/nptl/tst-sem8.c -+++ b/nptl/tst-sem8.c -@@ -31,8 +31,8 @@ remove_sem (int status, void *arg) - } - - --int --main (void) -+static int -+do_test (void) - { - sem_t *s; - int i; -@@ -71,3 +71,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/nptl/tst-sem9.c b/nptl/tst-sem9.c -index 9727486..b7d81a9 100644 ---- a/nptl/tst-sem9.c -+++ b/nptl/tst-sem9.c -@@ -31,8 +31,8 @@ remove_sem (int status, void *arg) - } - - --int --main (void) -+static int -+do_test (void) - { - sem_t *s; - int i; -@@ -78,3 +78,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/nss/test-netdb.c b/nss/test-netdb.c -index 1620b5b..384f32b 100644 ---- a/nss/test-netdb.c -+++ b/nss/test-netdb.c -@@ -356,8 +356,8 @@ setdb (const char *dbname) - } - - --int --main (void) -+static int -+do_test (void) - { - /* - setdb ("db"); -@@ -376,3 +376,6 @@ main (void) - - return (error_count != 0); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/posix/tst-fnmatch.c b/posix/tst-fnmatch.c -index ff2674c..021734d 100644 ---- a/posix/tst-fnmatch.c -+++ b/posix/tst-fnmatch.c -@@ -33,8 +33,8 @@ static char *flag_output (int flags); - static char *escape (const char *str, size_t *reslenp, char **resbuf); - - --int --main (void) -+static int -+do_test (void) - { - char *linebuf = NULL; - size_t linebuflen = 0; -@@ -388,3 +388,6 @@ escape (const char *str, size_t *reslenp, char **resbufp) - - return resbuf; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/posix/tst-getlogin.c b/posix/tst-getlogin.c -index 1393c3a..141a699 100644 ---- a/posix/tst-getlogin.c -+++ b/posix/tst-getlogin.c -@@ -19,8 +19,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - char *login; - int errors = 0; -@@ -55,3 +55,6 @@ main (void) - - return errors != 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/posix/tst-gnuglob.c b/posix/tst-gnuglob.c -index 1c72357..39b5b24 100644 ---- a/posix/tst-gnuglob.c -+++ b/posix/tst-gnuglob.c -@@ -379,8 +379,8 @@ test_result (const char *fmt, int flags, glob_t *gl, const char *str[]) - } - - --int --main (void) -+static int -+do_test (void) - { - glob_t gl; - int errval; -@@ -497,3 +497,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/posix/tst-mmap.c b/posix/tst-mmap.c -index c03acf5..5e52b49 100644 ---- a/posix/tst-mmap.c -+++ b/posix/tst-mmap.c -@@ -6,8 +6,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - FILE *fp; -@@ -195,3 +195,6 @@ main (void) - /* That's it. */ - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/pwd/tst-getpw.c b/pwd/tst-getpw.c -index 7875af9..7a2b9a3 100644 ---- a/pwd/tst-getpw.c -+++ b/pwd/tst-getpw.c -@@ -25,8 +25,8 @@ check (uid_t uid) - (void) getpw (uid, buf); - } - --int --main (void) -+static int -+do_test (void) - { - uid_t uid; - -@@ -38,3 +38,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/resolv/tst-inet_ntop.c b/resolv/tst-inet_ntop.c -index f968ec4..f0de063 100644 ---- a/resolv/tst-inet_ntop.c -+++ b/resolv/tst-inet_ntop.c -@@ -4,8 +4,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - struct in_addr addr4; - struct in6_addr addr6; -@@ -109,3 +109,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/rt/tst-timer.c b/rt/tst-timer.c -index f35d3e7..87f6491 100644 ---- a/rt/tst-timer.c -+++ b/rt/tst-timer.c -@@ -20,8 +20,8 @@ - - /* This file is only used if there is no other implementation and it should - means that there is no implementation of POSIX timers. */ --int --main (void) -+static int -+do_test (void) - { - #ifdef _POSIX_TIMERS - /* There should be a test. */ -@@ -30,3 +30,6 @@ main (void) - return 0; - #endif - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/test-fseek.c b/stdio-common/test-fseek.c -index fe57df6..8a7f1ae 100644 ---- a/stdio-common/test-fseek.c -+++ b/stdio-common/test-fseek.c -@@ -19,8 +19,8 @@ - - #define TESTFILE "/tmp/test.dat" - --int --main (void) -+static int -+do_test (void) - { - FILE *fp; - int i, j; -@@ -82,3 +82,6 @@ main (void) - puts ((i > 255) ? "Test succeeded." : "Test FAILED!"); - return (i > 255) ? 0 : 1; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/test-popen.c b/stdio-common/test-popen.c -index d36cd61..1f1c88a 100644 ---- a/stdio-common/test-popen.c -+++ b/stdio-common/test-popen.c -@@ -49,8 +49,8 @@ read_data (FILE *stream) - } - } - --int --main (void) -+static int -+do_test (void) - { - FILE *output, *input; - int wstatus, rstatus; -@@ -100,3 +100,6 @@ main (void) - puts (wstatus | rstatus ? "Test FAILED!" : "Test succeeded."); - return (wstatus | rstatus); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/test-vfprintf.c b/stdio-common/test-vfprintf.c -index a936c28..9cc56d7 100644 ---- a/stdio-common/test-vfprintf.c -+++ b/stdio-common/test-vfprintf.c -@@ -36,8 +36,8 @@ const char *locs[] = - - char large[50000]; - --int --main (void) -+static int -+do_test (void) - { - char buf[25]; - size_t i; -@@ -124,3 +124,6 @@ main (void) - - return res; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-cookie.c b/stdio-common/tst-cookie.c -index dcdabf3..030e684 100644 ---- a/stdio-common/tst-cookie.c -+++ b/stdio-common/tst-cookie.c -@@ -63,8 +63,8 @@ cookieclose (void *cookie) - } - - --int --main (void) -+static int -+do_test (void) - { - cookie_io_functions_t fcts; - char buf[1]; -@@ -90,3 +90,6 @@ main (void) - - return errors != 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-fileno.c b/stdio-common/tst-fileno.c -index a0c8853..753df9f 100644 ---- a/stdio-common/tst-fileno.c -+++ b/stdio-common/tst-fileno.c -@@ -28,10 +28,13 @@ check (const char *name, FILE *stream, int fd) - return sfd != fd; - } - --int --main (void) -+static int -+do_test (void) - { - return (check ("stdin", stdin, STDIN_FILENO) || - check ("stdout", stdout, STDOUT_FILENO) || - check ("stderr", stderr, STDERR_FILENO)); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-gets.c b/stdio-common/tst-gets.c -index 7f78fc1..052f1f9 100644 ---- a/stdio-common/tst-gets.c -+++ b/stdio-common/tst-gets.c -@@ -21,8 +21,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - char buf[100]; - int result = 0; -@@ -61,3 +61,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-obprintf.c b/stdio-common/tst-obprintf.c -index 39e8fda..5151593 100644 ---- a/stdio-common/tst-obprintf.c -+++ b/stdio-common/tst-obprintf.c -@@ -4,8 +4,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - struct obstack ob; - int n; -@@ -40,3 +40,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-perror.c b/stdio-common/tst-perror.c -index b809c2f..416b120 100644 ---- a/stdio-common/tst-perror.c -+++ b/stdio-common/tst-perror.c -@@ -24,8 +24,8 @@ - #define WC_EXP_LEN (sizeof (WC_EXP) - 1) - - --int --main (void) -+static int -+do_test (void) - { - int fd; - char fname[] = "/tmp/tst-perror.XXXXXX"; -@@ -152,3 +152,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-sprintf.c b/stdio-common/tst-sprintf.c -index c4e911f..2fe373f 100644 ---- a/stdio-common/tst-sprintf.c -+++ b/stdio-common/tst-sprintf.c -@@ -4,8 +4,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - char buf[100]; - int result = 0; -@@ -73,3 +73,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-sprintf2.c b/stdio-common/tst-sprintf2.c -index 422278d..0ddf15b 100644 ---- a/stdio-common/tst-sprintf2.c -+++ b/stdio-common/tst-sprintf2.c -@@ -3,8 +3,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - #if LDBL_MANT_DIG >= 106 - volatile union { long double l; long long x[2]; } u, v; -@@ -82,3 +82,6 @@ main (void) - #endif - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-sprintf3.c b/stdio-common/tst-sprintf3.c -index e54b23b..e927761 100644 ---- a/stdio-common/tst-sprintf3.c -+++ b/stdio-common/tst-sprintf3.c -@@ -22,8 +22,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - #if LDBL_MANT_DIG >= 106 - volatile union { long double l; long long x[2]; } u, v; -@@ -88,3 +88,6 @@ main (void) - #endif - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-swprintf.c b/stdio-common/tst-swprintf.c -index e65234b..ce62c6b 100644 ---- a/stdio-common/tst-swprintf.c -+++ b/stdio-common/tst-swprintf.c -@@ -12,8 +12,8 @@ - - const char input[] = "\x8e\xa1g\x8e\xa2h\x8e\xa3i\x8e\xa4j"; - --int --main (void) -+static int -+do_test (void) - { - wchar_t buf[1000]; - #define nbuf (sizeof (buf) / sizeof (buf[0])) -@@ -54,3 +54,6 @@ swprintf (.., .., L\"%ls\", \"%ls\") produced \"%ls\", not \"%ls\"\n", \ - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-tmpnam.c b/stdio-common/tst-tmpnam.c -index a3bd9fb..3b97064 100644 ---- a/stdio-common/tst-tmpnam.c -+++ b/stdio-common/tst-tmpnam.c -@@ -19,8 +19,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - const char *name; - int retval = 0; -@@ -48,3 +48,6 @@ main (void) - - return retval; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-unbputc.c b/stdio-common/tst-unbputc.c -index bbd8622..7200a82 100644 ---- a/stdio-common/tst-unbputc.c -+++ b/stdio-common/tst-unbputc.c -@@ -1,11 +1,14 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - putc ('1', stderr); - putc ('2', stderr); - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdio-common/tst-wc-printf.c b/stdio-common/tst-wc-printf.c -index abbeeb5..2a2acb5 100644 ---- a/stdio-common/tst-wc-printf.c -+++ b/stdio-common/tst-wc-printf.c -@@ -4,8 +4,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - wchar_t tmp[3]; - tmp[0] = '8'; -@@ -20,3 +20,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-environ.c b/stdlib/tst-environ.c -index 3316d7e..b1de2f9 100644 ---- a/stdlib/tst-environ.c -+++ b/stdlib/tst-environ.c -@@ -25,8 +25,8 @@ - - char putenv_val[100] = VAR "=some longer value"; - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - const char *valp; -@@ -219,3 +219,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-fmtmsg.c b/stdlib/tst-fmtmsg.c -index c3748d6..b7948c5 100644 ---- a/stdlib/tst-fmtmsg.c -+++ b/stdlib/tst-fmtmsg.c -@@ -7,8 +7,8 @@ - - #define MM_TEST 10 - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -80,3 +80,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-limits.c b/stdlib/tst-limits.c -index 265b9db..6e51dca 100644 ---- a/stdlib/tst-limits.c -+++ b/stdlib/tst-limits.c -@@ -16,8 +16,8 @@ bitval (int bits) - } - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -67,3 +67,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-rand48-2.c b/stdlib/tst-rand48-2.c -index 3079b98..8b8fef4 100644 ---- a/stdlib/tst-rand48-2.c -+++ b/stdlib/tst-rand48-2.c -@@ -3,8 +3,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - time_t t = time (NULL); - int i, ret = 0; -@@ -111,3 +111,6 @@ main (void) - - return ret; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-rand48.c b/stdlib/tst-rand48.c -index 52e1b96..973c62e 100644 ---- a/stdlib/tst-rand48.c -+++ b/stdlib/tst-rand48.c -@@ -8,8 +8,8 @@ - #endif - - --int --main (void) -+static int -+do_test (void) - { - unsigned short int xs[3] = { 0x0001, 0x0012, 0x0123 }; - unsigned short int lxs[7]; -@@ -388,3 +388,6 @@ drand48() and erand48 in lines %d and %d produce different results\n", - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-random.c b/stdlib/tst-random.c -index 47195d6..8fe0993 100644 ---- a/stdlib/tst-random.c -+++ b/stdlib/tst-random.c -@@ -46,8 +46,8 @@ const unsigned int seed[3] = { 0x12344321U, 0xEE11DD22U, 0xFEDCBA98 }; - - void fail (const char *msg, int s, int i) __attribute__ ((__noreturn__)); - --int --main (void) -+static int -+do_test (void) - { - long int rnd[nseq][nrnd]; /* pseudorandom numbers */ - char* state[nseq]; /* state for PRNG */ -@@ -117,3 +117,6 @@ fail (const char *msg, int s, int i) - printf ("%s (seq %d, pos %d).\n", msg, s, i); - exit (1); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-random2.c b/stdlib/tst-random2.c -index 0553b62..da840f3 100644 ---- a/stdlib/tst-random2.c -+++ b/stdlib/tst-random2.c -@@ -20,8 +20,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - int pass; - int ret = 0; -@@ -56,3 +56,6 @@ main (void) - } - return ret; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-strtol.c b/stdlib/tst-strtol.c -index eebd8f7..448102a 100644 ---- a/stdlib/tst-strtol.c -+++ b/stdlib/tst-strtol.c -@@ -534,8 +534,8 @@ static const struct ltest tests[] = - /* Prototypes for local functions. */ - static void expand (char *dst, int c); - --int --main (void) -+static int -+do_test (void) - { - const struct ltest *lt; - char *ep; -@@ -623,3 +623,6 @@ expand (dst, c) - else - (void) sprintf (dst, "%#.3o", (unsigned int) c); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-strtoll.c b/stdlib/tst-strtoll.c -index 0c77254..93f1a56 100644 ---- a/stdlib/tst-strtoll.c -+++ b/stdlib/tst-strtoll.c -@@ -309,8 +309,8 @@ static const struct ltest tests[] = - /* Prototypes for local functions. */ - static void expand (char *dst, int c); - --int --main (void) -+static int -+do_test (void) - { - const struct ltest *lt; - char *ep; -@@ -398,3 +398,6 @@ expand (dst, c) - else - (void) sprintf (dst, "%#.3o", (unsigned int) c); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-tls-atexit.c b/stdlib/tst-tls-atexit.c -index 1ba3fae..c03a3e5 100644 ---- a/stdlib/tst-tls-atexit.c -+++ b/stdlib/tst-tls-atexit.c -@@ -60,8 +60,8 @@ load (void *u) - return NULL; - } - --int --main (void) -+static int -+do_test (void) - { - pthread_t t; - int ret; -@@ -109,3 +109,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/stdlib/tst-xpg-basename.c b/stdlib/tst-xpg-basename.c -index 61e2e4b..facc783 100644 ---- a/stdlib/tst-xpg-basename.c -+++ b/stdlib/tst-xpg-basename.c -@@ -37,8 +37,8 @@ static struct - }; - - --int --main (void) -+static int -+do_test (void) - { - size_t i = 0; - int errors = 0; -@@ -64,3 +64,6 @@ main (void) - - return errors; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/string/test-ffs.c b/string/test-ffs.c -index 7ac1dd6..a64a1cc 100644 ---- a/string/test-ffs.c -+++ b/string/test-ffs.c -@@ -21,8 +21,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - int failures = 0; - int i; -@@ -61,3 +61,6 @@ main (void) - - return failures; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/string/tst-bswap.c b/string/tst-bswap.c -index cca704c..6c1c911 100644 ---- a/string/tst-bswap.c -+++ b/string/tst-bswap.c -@@ -21,8 +21,8 @@ - - extern unsigned long long int wash (unsigned long long int a); - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -71,3 +71,6 @@ wash (unsigned long long int a) - regards the argument to the bswap_*() functions as constant. */ - return a + 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/string/tst-inlcall.c b/string/tst-inlcall.c -index 32d8863..0f8b1bd 100644 ---- a/string/tst-inlcall.c -+++ b/string/tst-inlcall.c -@@ -31,8 +31,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - int status; - int errors = 0; -@@ -80,3 +80,6 @@ main (void) - } - return status; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/string/tst-strtok.c b/string/tst-strtok.c -index 7e34aee..6fbef9f 100644 ---- a/string/tst-strtok.c -+++ b/string/tst-strtok.c -@@ -2,8 +2,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - char buf[1] = { 0 }; - int result = 0; -@@ -21,3 +21,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/string/tst-strxfrm.c b/string/tst-strxfrm.c -index 2ae2e29..f48cfc0 100644 ---- a/string/tst-strxfrm.c -+++ b/string/tst-strxfrm.c -@@ -58,8 +58,8 @@ test (const char *locale) - } - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -69,3 +69,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/sysdeps/x86_64/tst-audit10.c b/sysdeps/x86_64/tst-audit10.c -index 24c9696..8d6721a 100644 ---- a/sysdeps/x86_64/tst-audit10.c -+++ b/sysdeps/x86_64/tst-audit10.c -@@ -45,8 +45,8 @@ avx512_enabled (void) - - extern __m512i audit_test (__m512i, __m512i, __m512i, __m512i, - __m512i, __m512i, __m512i, __m512i); --int --main (void) -+static int -+do_test (void) - { - /* Run AVX512 test only if AVX512 is supported. */ - if (avx512_enabled ()) -@@ -62,9 +62,12 @@ main (void) - return 0; - } - #else --int --main (void) -+static int -+do_test (void) - { - return 0; - } - #endif -+ -+#define TEST_FUNCTION do_test () -+#include "../../test-skeleton.c" -diff --git a/sysdeps/x86_64/tst-audit3.c b/sysdeps/x86_64/tst-audit3.c -index d00db99..0602aa2 100644 ---- a/sysdeps/x86_64/tst-audit3.c -+++ b/sysdeps/x86_64/tst-audit3.c -@@ -7,8 +7,8 @@ - - extern __m128i audit_test (__m128i, __m128i, __m128i, __m128i, - __m128i, __m128i, __m128i, __m128i); --int --main (void) -+static int -+do_test (void) - { - __m128i xmm = _mm_setzero_si128 (); - __m128i ret = audit_test (xmm, xmm, xmm, xmm, xmm, xmm, xmm, xmm); -@@ -18,3 +18,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../../test-skeleton.c" -diff --git a/sysdeps/x86_64/tst-audit4.c b/sysdeps/x86_64/tst-audit4.c -index c4f1d5b..44d5123 100644 ---- a/sysdeps/x86_64/tst-audit4.c -+++ b/sysdeps/x86_64/tst-audit4.c -@@ -25,8 +25,8 @@ avx_enabled (void) - - extern __m256i audit_test (__m256i, __m256i, __m256i, __m256i, - __m256i, __m256i, __m256i, __m256i); --int --main (void) -+static int -+do_test (void) - { - /* Run AVX test only if AVX is supported. */ - if (avx_enabled ()) -@@ -41,9 +41,12 @@ main (void) - return 0; - } - #else --int --main (void) -+static int -+do_test (void) - { - return 0; - } - #endif -+ -+#define TEST_FUNCTION do_test () -+#include "../../test-skeleton.c" -diff --git a/sysdeps/x86_64/tst-audit5.c b/sysdeps/x86_64/tst-audit5.c -index 0094fee..225b4c8 100644 ---- a/sysdeps/x86_64/tst-audit5.c -+++ b/sysdeps/x86_64/tst-audit5.c -@@ -7,8 +7,8 @@ - - extern __m128i audit_test (__m128i, __m128i, __m128i, __m128i, - __m128i, __m128i, __m128i, __m128i); --int --main (void) -+static int -+do_test (void) - { - __m128i xmm = _mm_setzero_si128 (); - __m128i ret = audit_test (xmm, xmm, xmm, xmm, xmm, xmm, xmm, xmm); -@@ -19,3 +19,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../../test-skeleton.c" -diff --git a/time/tst-ftime_l.c b/time/tst-ftime_l.c -index fc3d78d..6690efe 100644 ---- a/time/tst-ftime_l.c -+++ b/time/tst-ftime_l.c -@@ -6,8 +6,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - locale_t l; - locale_t old; -@@ -124,3 +124,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/time/tst-getdate.c b/time/tst-getdate.c -index fd87923..b3377ee 100644 ---- a/time/tst-getdate.c -+++ b/time/tst-getdate.c -@@ -76,8 +76,8 @@ report_date_error (int err) - } - - --int --main (void) -+static int -+do_test (void) - { - int errors = 0; - size_t i; -@@ -121,3 +121,6 @@ main (void) - printf ("No errors found.\n"); - return errors != 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/time/tst-mktime.c b/time/tst-mktime.c -index 416a856..c147360 100644 ---- a/time/tst-mktime.c -+++ b/time/tst-mktime.c -@@ -3,8 +3,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - struct tm time_str, *tm; - time_t t; -@@ -68,3 +68,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/time/tst-mktime3.c b/time/tst-mktime3.c -index 60d0e0b..c738e53 100644 ---- a/time/tst-mktime3.c -+++ b/time/tst-mktime3.c -@@ -17,8 +17,8 @@ struct tm expected[] = - { .tm_sec = 5, .tm_mday = 1, .tm_year = 102, .tm_wday = 2 } - }; - --int --main (void) -+static int -+do_test (void) - { - setenv ("TZ", "UTC", 1); - int i; -@@ -48,3 +48,6 @@ main (void) - } - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/time/tst-posixtz.c b/time/tst-posixtz.c -index 019d92a..c1ea267 100644 ---- a/time/tst-posixtz.c -+++ b/time/tst-posixtz.c -@@ -28,8 +28,8 @@ struct - "1999/02/25 15:18:12 dst=0 zone=EST" }, - }; - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - size_t cnt; -@@ -116,3 +116,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/time/tst-strptime2.c b/time/tst-strptime2.c -index 73552bb..bcd6cc8 100644 ---- a/time/tst-strptime2.c -+++ b/time/tst-strptime2.c -@@ -26,8 +26,8 @@ static const struct - #define ntests (sizeof (tests) / sizeof (tests[0])) - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -57,3 +57,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/time/tst-strptime3.c b/time/tst-strptime3.c -index 9a8c648..75b57c1 100644 ---- a/time/tst-strptime3.c -+++ b/time/tst-strptime3.c -@@ -4,8 +4,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - struct tm tm; -@@ -53,3 +53,6 @@ main (void) - - return 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/wcsmbs/tst-btowc.c b/wcsmbs/tst-btowc.c -index d793622..dc34f2b 100644 ---- a/wcsmbs/tst-btowc.c -+++ b/wcsmbs/tst-btowc.c -@@ -74,8 +74,8 @@ eof_test (void) - - - /* Test the btowc() function for a few locales with known character sets. */ --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -172,3 +172,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/wcsmbs/tst-mbrtowc.c b/wcsmbs/tst-mbrtowc.c -index 3e1eb72..a30b619 100644 ---- a/wcsmbs/tst-mbrtowc.c -+++ b/wcsmbs/tst-mbrtowc.c -@@ -151,8 +151,8 @@ utf8_test (void) - } - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -230,3 +230,6 @@ check_ascii (const char *locname) - - return res != 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/wcsmbs/tst-mbsrtowcs.c b/wcsmbs/tst-mbsrtowcs.c -index 8d7e2cb..405534d 100644 ---- a/wcsmbs/tst-mbsrtowcs.c -+++ b/wcsmbs/tst-mbsrtowcs.c -@@ -21,8 +21,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - const unsigned char buf[] = { 'a', 'b', '\0', 'c', 'd', '\0', 'e' }; - wchar_t out[sizeof (buf)]; -@@ -62,3 +62,6 @@ main (void) - } - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/wcsmbs/tst-wchar-h.c b/wcsmbs/tst-wchar-h.c -index 4cf2dd0..fd2ad56 100644 ---- a/wcsmbs/tst-wchar-h.c -+++ b/wcsmbs/tst-wchar-h.c -@@ -1,9 +1,12 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - mbstate_t x; - return sizeof (x) - sizeof (mbstate_t); - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/wcsmbs/tst-wcpncpy.c b/wcsmbs/tst-wcpncpy.c -index 74765e7..4cf4aec 100644 ---- a/wcsmbs/tst-wcpncpy.c -+++ b/wcsmbs/tst-wcpncpy.c -@@ -20,8 +20,8 @@ - #include - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -74,3 +74,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/wcsmbs/tst-wcrtomb.c b/wcsmbs/tst-wcrtomb.c -index 3f052f3..cad343e 100644 ---- a/wcsmbs/tst-wcrtomb.c -+++ b/wcsmbs/tst-wcrtomb.c -@@ -26,8 +26,8 @@ - static int check_ascii (const char *locname); - - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - -@@ -92,3 +92,6 @@ check_ascii (const char *locname) - - return res != 0; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/wcsmbs/tst-wcsnlen.c b/wcsmbs/tst-wcsnlen.c -index 60e64ad..8d4b8b5 100644 ---- a/wcsmbs/tst-wcsnlen.c -+++ b/wcsmbs/tst-wcsnlen.c -@@ -27,8 +27,8 @@ - printf ("wcsnlen (L\"%s\", %d) = %d, not %d\n", Str, Max, n, Exp); \ - } - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - int n; -@@ -48,3 +48,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -diff --git a/wcsmbs/tst-wcstof.c b/wcsmbs/tst-wcstof.c -index 197cb5c..576a58c 100644 ---- a/wcsmbs/tst-wcstof.c -+++ b/wcsmbs/tst-wcstof.c -@@ -4,8 +4,8 @@ - #include - #include - --int --main (void) -+static int -+do_test (void) - { - int result = 0; - char buf[100]; -@@ -21,3 +21,6 @@ main (void) - - return result; - } -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" diff --git a/glibc-fix-an_ES.patch b/glibc-fix-an_ES.patch deleted file mode 100644 index 745fa3f..0000000 --- a/glibc-fix-an_ES.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: glibc-2.23-69-gf5e753c8/localedata/locales/an_ES -=================================================================== ---- glibc-2.23-69-gf5e753c8.orig/localedata/locales/an_ES -+++ glibc-2.23-69-gf5e753c8/localedata/locales/an_ES -@@ -134,7 +134,7 @@ postal_fmt "" - country_ab3 "" - country_num 724 --lang_ab "" -+lang_ab "" - % E - country_car "" - % aragonés diff --git a/glibc-rh1052846.patch b/glibc-rh1052846.patch deleted file mode 100644 index cbc670e..0000000 --- a/glibc-rh1052846.patch +++ /dev/null @@ -1,47 +0,0 @@ -commit 403ce35141da511898cde550f48ebc68a2a3ac82 -Author: Siddhesh Poyarekar -Date: Mon Jan 6 14:37:21 2014 +0530 - - Fix infinite loop in ftell when writing wide char data (BZ #16398) - - ftell tries to avoid flushing the buffer when it is in write mode by - converting the wide char data and placing it into the binary buffer. - If the output buffer space is full and there is data to write, the - code reverts to flushing the buffer. This breaks when there is space - in the buffer but it is not enough to convert the next character in - the wide data buffer, due to which __codecvt_do_out returns a - __codecvt_partial status. In this case, ftell keeps running in an - infinite loop. - - The fix here is to detect the __codecvt_partial status in addition to - checking if the buffer is full. - -diff --git a/libio/wfileops.c b/libio/wfileops.c -index 87d3cdc..877fc1f 100644 ---- a/libio/wfileops.c -+++ b/libio/wfileops.c -@@ -715,7 +715,7 @@ _IO_wfile_seekoff (fp, offset, dir, mode) - - fp->_wide_data->_IO_write_base) / clen; - else - { -- enum __codecvt_result status; -+ enum __codecvt_result status = __codecvt_ok; - delta = (fp->_wide_data->_IO_write_ptr - - fp->_wide_data->_IO_write_base); - const wchar_t *write_base = fp->_wide_data->_IO_write_base; -@@ -728,9 +728,12 @@ _IO_wfile_seekoff (fp, offset, dir, mode) - flush buffers for every ftell. */ - do - { -- /* Ugh, no point trying to avoid the flush. Just do it -- and go back to how it was with the read mode. */ -- if (delta > 0 && new_write_ptr == fp->_IO_buf_end) -+ /* There is not enough space in the buffer to do the entire -+ conversion, so there is no point trying to avoid the -+ buffer flush. Just do it and go back to how it was with -+ the read mode. */ -+ if (status == __codecvt_partial -+ || (delta > 0 && new_write_ptr == fp->_IO_buf_end)) - { - if (_IO_switch_to_wget_mode (fp)) - return WEOF; diff --git a/glibc-rh1069559-1.patch b/glibc-rh1069559-1.patch deleted file mode 100644 index 9c098c2..0000000 --- a/glibc-rh1069559-1.patch +++ /dev/null @@ -1,836 +0,0 @@ -commit 03425ba6ab17b87b2c64f0d7b47fb0b86add9993 -Author: Siddhesh Poyarekar -Date: Thu Feb 20 15:41:18 2014 +0530 - - Separate ftell from fseek logic and avoid modifying FILE data (#16532) - - ftell semantics are distinct from fseek(SEEK_CUR) especially when it - is called on a file handler that is not yet active. Due to this - caveat, much care needs to be taken while modifying the handler data - and hence, this first iteration on separating out ftell focusses on - maintaining handler data integrity at all times while it figures out - the current stream offset. The result is that it makes a syscall for - every offset request. - - There is scope for optimizing this by caching offsets when we know - that the handler is active. A simple way to find out is when the - buffers have data. It is not so simple to find this out when the - buffer is empty without adding some kind of flag. - -diff --git a/libio/Makefile b/libio/Makefile -index 8c333ce..8ccd80f 100644 ---- a/libio/Makefile -+++ b/libio/Makefile -@@ -60,7 +60,7 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \ - tst-wmemstream1 tst-wmemstream2 \ - bug-memstream1 bug-wmemstream1 \ - tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \ -- tst-fwrite-error tst-ftell-partial-wide -+ tst-fwrite-error tst-ftell-partial-wide tst-ftell-active-handler - ifeq (yes,$(build-shared)) - # Add test-fopenloc only if shared library is enabled since it depends on - # shared localedata objects. -diff --git a/libio/fileops.c b/libio/fileops.c -index a3499be..a177302 100644 ---- a/libio/fileops.c -+++ b/libio/fileops.c -@@ -931,6 +931,59 @@ _IO_file_sync_mmap (_IO_FILE *fp) - - - _IO_off64_t -+get_file_offset (_IO_FILE *fp) -+{ -+ if ((fp->_flags & _IO_IS_APPENDING) == _IO_IS_APPENDING) -+ { -+ struct stat64 st; -+ bool ret = (_IO_SYSSTAT (fp, &st) == 0 && S_ISREG (st.st_mode)); -+ if (ret) -+ return st.st_size; -+ else -+ return EOF; -+ } -+ else -+ return _IO_SYSSEEK (fp, 0, _IO_seek_cur); -+} -+ -+ -+/* ftell{,o} implementation. Don't modify any state of the file pointer while -+ we try to get the current state of the stream. */ -+static _IO_off64_t -+do_ftell (_IO_FILE *fp) -+{ -+ _IO_off64_t result; -+ -+ result = get_file_offset (fp); -+ -+ if (result == EOF) -+ return result; -+ -+ /* No point looking at unflushed data if we haven't allocated buffers -+ yet. */ -+ if (fp->_IO_buf_base != NULL) -+ { -+ bool was_writing = (fp->_IO_write_ptr > fp->_IO_write_base -+ || _IO_in_put_mode (fp)); -+ -+ /* Adjust for unflushed data. */ -+ if (!was_writing) -+ result -= fp->_IO_read_end - fp->_IO_read_ptr; -+ else -+ result += fp->_IO_write_ptr - fp->_IO_read_end; -+ } -+ -+ if (result < 0) -+ { -+ __set_errno (EINVAL); -+ return EOF; -+ } -+ -+ return result; -+} -+ -+ -+_IO_off64_t - _IO_new_file_seekoff (fp, offset, dir, mode) - _IO_FILE *fp; - _IO_off64_t offset; -@@ -940,6 +993,13 @@ _IO_new_file_seekoff (fp, offset, dir, mode) - _IO_off64_t result; - _IO_off64_t delta, new_offset; - long count; -+ -+ /* Short-circuit into a separate function. We don't want to mix any -+ functionality and we don't want to touch anything inside the FILE -+ object. */ -+ if (mode == 0) -+ return do_ftell (fp); -+ - /* POSIX.1 8.2.3.7 says that after a call the fflush() the file - offset of the underlying file must be exact. */ - int must_be_exact = (fp->_IO_read_base == fp->_IO_read_end -@@ -948,9 +1008,6 @@ _IO_new_file_seekoff (fp, offset, dir, mode) - bool was_writing = (fp->_IO_write_ptr > fp->_IO_write_base - || _IO_in_put_mode (fp)); - -- if (mode == 0) -- dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */ -- - /* Flush unwritten characters. - (This may do an unneeded write if we seek within the buffer. - But to be able to switch to reading, we would need to set -@@ -958,7 +1015,7 @@ _IO_new_file_seekoff (fp, offset, dir, mode) - which assumes file_ptr() is eGptr. Anyway, since we probably - end up flushing when we close(), it doesn't make much difference.) - FIXME: simulate mem-mapped files. */ -- else if (was_writing && _IO_switch_to_get_mode (fp)) -+ if (was_writing && _IO_switch_to_get_mode (fp)) - return EOF; - - if (fp->_IO_buf_base == NULL) -@@ -978,30 +1035,10 @@ _IO_new_file_seekoff (fp, offset, dir, mode) - { - case _IO_seek_cur: - /* Adjust for read-ahead (bytes is buffer). */ -- if (mode != 0 || !was_writing) -- offset -= fp->_IO_read_end - fp->_IO_read_ptr; -- else -- { -- /* _IO_read_end coincides with fp._offset, so the actual file position -- is fp._offset - (_IO_read_end - new_write_ptr). This is fine -- even if fp._offset is not set, since fp->_IO_read_end is then at -- _IO_buf_base and this adjustment is for unbuffered output. */ -- offset -= fp->_IO_read_end - fp->_IO_write_ptr; -- } -+ offset -= fp->_IO_read_end - fp->_IO_read_ptr; - - if (fp->_offset == _IO_pos_BAD) -- { -- if (mode != 0) -- goto dumb; -- else -- { -- result = _IO_SYSSEEK (fp, 0, dir); -- if (result == EOF) -- return result; -- -- fp->_offset = result; -- } -- } -+ goto dumb; - /* Make offset absolute, assuming current pointer is file_ptr(). */ - offset += fp->_offset; - if (offset < 0) -@@ -1028,10 +1065,6 @@ _IO_new_file_seekoff (fp, offset, dir, mode) - } - /* At this point, dir==_IO_seek_set. */ - -- /* If we are only interested in the current position we've found it now. */ -- if (mode == 0) -- return offset; -- - /* If destination is within current buffer, optimize: */ - if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL - && !_IO_in_backup (fp)) -diff --git a/libio/libioP.h b/libio/libioP.h -index 4ca723c..8a7b85b 100644 ---- a/libio/libioP.h -+++ b/libio/libioP.h -@@ -397,6 +397,7 @@ extern void _IO_wdoallocbuf (_IO_FILE *) __THROW; - libc_hidden_proto (_IO_wdoallocbuf) - extern void _IO_unsave_wmarkers (_IO_FILE *) __THROW; - extern unsigned _IO_adjust_wcolumn (unsigned, const wchar_t *, int) __THROW; -+extern _IO_off64_t get_file_offset (_IO_FILE *fp); - - /* Marker-related function. */ - -diff --git a/libio/tst-ftell-active-handler.c b/libio/tst-ftell-active-handler.c -new file mode 100644 -index 0000000..aac2923 ---- /dev/null -+++ b/libio/tst-ftell-active-handler.c -@@ -0,0 +1,366 @@ -+/* Verify that ftell returns the correct value at various points before and -+ after the handler on which it is called becomes active. -+ Copyright (C) 2014 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int do_test (void); -+ -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -+ -+#define get_handles_fdopen(filename, fd, fp, fd_mode, mode) \ -+({ \ -+ int ret = 0; \ -+ (fd) = open ((filename), (fd_mode), 0); \ -+ if ((fd) == -1) \ -+ { \ -+ printf ("open failed: %m\n"); \ -+ ret = 1; \ -+ } \ -+ else \ -+ { \ -+ (fp) = fdopen ((fd), (mode)); \ -+ if ((fp) == NULL) \ -+ { \ -+ printf ("fdopen failed: %m\n"); \ -+ close (fd); \ -+ ret = 1; \ -+ } \ -+ } \ -+ ret; \ -+}) -+ -+#define get_handles_fopen(filename, fd, fp, mode) \ -+({ \ -+ int ret = 0; \ -+ (fp) = fopen ((filename), (mode)); \ -+ if ((fp) == NULL) \ -+ { \ -+ printf ("fopen failed: %m\n"); \ -+ ret = 1; \ -+ } \ -+ else \ -+ { \ -+ (fd) = fileno (fp); \ -+ if ((fd) == -1) \ -+ { \ -+ printf ("fileno failed: %m\n"); \ -+ ret = 1; \ -+ } \ -+ } \ -+ ret; \ -+}) -+ -+static const void *data; -+static const char *char_data = "abcdef"; -+static const wchar_t *wide_data = L"abcdef"; -+static size_t data_len; -+/* Maintain the current file length for validation. */ -+static size_t file_len; -+ -+typedef int (*fputs_func_t) (const void *data, FILE *fp); -+fputs_func_t fputs_func; -+ -+/* Test that the value of ftell is not cached when the stream handle is not -+ active. */ -+static int -+do_ftell_test (const char *filename) -+{ -+ int ret = 0; -+ struct test -+ { -+ const char *mode; -+ int fd_mode; -+ size_t old_off; -+ size_t new_off; -+ } test_modes[] = { -+ {"w", O_WRONLY, 0, data_len}, -+ {"w+", O_RDWR, 0, data_len}, -+ {"r+", O_RDWR, 0, data_len}, -+ {"a", O_WRONLY, data_len, 2 * data_len}, -+ {"a+", O_RDWR, 2 * data_len, 3 * data_len}, -+ }; -+ for (int j = 0; j < 2; j++) -+ { -+ for (int i = 0; i < sizeof (test_modes) / sizeof (struct test); i++) -+ { -+ FILE *fp; -+ int fd; -+ printf ("\tftell: %s (file, \"%s\"): ", j == 0 ? "fdopen" : "fopen", -+ test_modes[i].mode); -+ -+ if (j == 0) -+ ret = get_handles_fdopen (filename, fd, fp, test_modes[i].fd_mode, -+ test_modes[i].mode); -+ else -+ ret = get_handles_fopen (filename, fd, fp, test_modes[i].mode); -+ -+ if (ret != 0) -+ return 1; -+ -+ long off = ftell (fp); -+ if (off != test_modes[i].old_off) -+ { -+ printf ("Incorrect old offset. Expected %zu but got %ld, ", -+ test_modes[i].old_off, off); -+ ret |= 1; -+ } -+ else -+ printf ("old offset = %ld, ", off); -+ -+ int ret = write (fd, data, data_len); -+ off = ftell (fp); -+ -+ if (off != test_modes[i].new_off) -+ { -+ printf ("Incorrect new offset. Expected %zu but got %ld\n", -+ test_modes[i].old_off, off); -+ ret |= 1; -+ } -+ else -+ printf ("new offset = %ld\n", off); -+ -+ fclose (fp); -+ } -+ } -+ -+ return ret; -+} -+ -+/* This test opens the file for writing, moves the file offset of the -+ underlying file, writes out data and then checks if ftell trips on it. */ -+static int -+do_write_test (const char *filename) -+{ -+ FILE *fp = NULL; -+ int fd; -+ int ret = 0; -+ struct test -+ { -+ const char *mode; -+ int fd_mode; -+ } test_modes[] = { -+ {"w", O_WRONLY}, -+ {"w+", O_RDWR}, -+ {"r+", O_RDWR} -+ }; -+ -+ for (int j = 0; j < 2; j++) -+ { -+ for (int i = 0; i < sizeof (test_modes) / sizeof (struct test); i++) -+ { -+ printf ("\twrite: %s (file, \"%s\"): ", j == 0 ? "fopen" : "fdopen", -+ test_modes[i].mode); -+ -+ if (j == 0) -+ ret = get_handles_fopen (filename, fd, fp, test_modes[i].mode); -+ else -+ ret = get_handles_fdopen (filename, fd, fp, test_modes[i].fd_mode, -+ test_modes[i].mode); -+ -+ if (ret != 0) -+ return ret; -+ -+ /* Move offset to just before the end of the file. */ -+ off_t ret = lseek (fd, file_len - 1, SEEK_SET); -+ if (ret == -1) -+ { -+ printf ("lseek failed: %m\n"); -+ ret |= 1; -+ } -+ -+ /* Write some data. */ -+ size_t written = fputs_func (data, fp); -+ -+ if (written == EOF) -+ { -+ printf ("fputs[1] failed to write data\n"); -+ ret |= 1; -+ } -+ -+ /* Verify that the offset points to the end of the file. */ -+ long offset = ftell (fp); -+ file_len = file_len - 1 + data_len; -+ -+ if (offset != file_len) -+ { -+ printf ("Incorrect offset. Expected %zu, but got %ld\n", -+ file_len, offset); -+ -+ ret |= 1; -+ } -+ -+ printf ("offset = %ld\n", offset); -+ fclose (fp); -+ } -+ } -+ -+ return ret; -+} -+ -+/* This test opens a file in append mode, writes some data, and then verifies -+ that ftell does not trip over it. */ -+static int -+do_append_test (const char *filename) -+{ -+ FILE *fp = NULL; -+ int ret = 0; -+ int fd; -+ -+ struct test -+ { -+ const char *mode; -+ int fd_mode; -+ } test_modes[] = { -+ {"a", O_WRONLY}, -+ {"a+", O_RDWR} -+ }; -+ -+ for (int j = 0; j < 2; j++) -+ { -+ for (int i = 0; i < sizeof (test_modes) / sizeof (struct test); i++) -+ { -+ printf ("\tappend: %s (file, \"%s\"): ", j == 0 ? "fopen" : "fdopen", -+ test_modes[i].mode); -+ -+ if (j == 0) -+ ret = get_handles_fopen (filename, fd, fp, test_modes[i].mode); -+ else -+ ret = get_handles_fdopen (filename, fd, fp, test_modes[i].fd_mode, -+ test_modes[i].mode); -+ -+ if (ret != 0) -+ return ret; -+ -+ /* Write some data. */ -+ size_t written = fputs_func (data, fp); -+ -+ if (written == EOF) -+ { -+ printf ("fputs[1] failed to write all data\n"); -+ ret |= 1; -+ } -+ -+ /* Verify that the offset points to the end of the file. */ -+ long offset = ftell (fp); -+ file_len += data_len; -+ -+ if (offset != file_len) -+ { -+ printf ("Incorrect offset. Expected %zu, but got %ld\n", -+ file_len, offset); -+ -+ ret |= 1; -+ } -+ -+ printf ("offset = %ld\n", offset); -+ fclose (fp); -+ } -+ } -+ -+ return ret; -+} -+ -+static int -+do_one_test (const char *filename) -+{ -+ int ret = 0; -+ -+ ret |= do_ftell_test (filename); -+ ret |= do_write_test (filename); -+ ret |= do_append_test (filename); -+ -+ return ret; -+} -+ -+static int -+do_test (void) -+{ -+ int ret = 0; -+ FILE *fp = NULL; -+ char *filename; -+ size_t written; -+ int fd = create_temp_file ("tst-active-handler-tmp.", &filename); -+ -+ if (fd == -1) -+ { -+ printf ("create_temp_file: %m\n"); -+ return 1; -+ } -+ -+ fp = fdopen (fd, "w"); -+ if (fp == NULL) -+ { -+ printf ("fdopen[0]: %m\n"); -+ close (fd); -+ return 1; -+ } -+ -+ data = char_data; -+ data_len = strlen (char_data); -+ file_len = strlen (char_data); -+ written = fputs (data, fp); -+ -+ if (written == EOF) -+ { -+ printf ("fputs[1] failed to write data\n"); -+ ret = 1; -+ } -+ -+ fclose (fp); -+ if (ret) -+ return ret; -+ -+ /* Tests for regular files. */ -+ puts ("Regular mode:"); -+ fputs_func = (fputs_func_t) fputs; -+ data = char_data; -+ data_len = strlen (char_data); -+ ret |= do_one_test (filename); -+ -+ /* Truncate the file before repeating the tests in wide mode. */ -+ fp = fopen (filename, "w"); -+ if (fp == NULL) -+ { -+ printf ("fopen failed %m\n"); -+ return 1; -+ } -+ fclose (fp); -+ -+ /* Tests for wide files. */ -+ puts ("Wide mode:"); -+ if (setlocale (LC_ALL, "en_US.UTF-8") == NULL) -+ { -+ printf ("Cannot set en_US.UTF-8 locale.\n"); -+ return 1; -+ } -+ fputs_func = (fputs_func_t) fputws; -+ data = wide_data; -+ data_len = wcslen (wide_data); -+ ret |= do_one_test (filename); -+ -+ return ret; -+} -diff --git a/libio/wfileops.c b/libio/wfileops.c -index 9cebe77..eda7828 100644 ---- a/libio/wfileops.c -+++ b/libio/wfileops.c -@@ -596,29 +596,22 @@ done: - return 0; - } - --_IO_off64_t --_IO_wfile_seekoff (fp, offset, dir, mode) -- _IO_FILE *fp; -- _IO_off64_t offset; -- int dir; -- int mode; -+static _IO_off64_t -+do_ftell_wide (_IO_FILE *fp) - { -- _IO_off64_t result; -- _IO_off64_t delta, new_offset; -- long int count; -- /* POSIX.1 8.2.3.7 says that after a call the fflush() the file -- offset of the underlying file must be exact. */ -- int must_be_exact = ((fp->_wide_data->_IO_read_base -- == fp->_wide_data->_IO_read_end) -- && (fp->_wide_data->_IO_write_base -- == fp->_wide_data->_IO_write_ptr)); -+ _IO_off64_t result, offset = 0; - -- bool was_writing = ((fp->_wide_data->_IO_write_ptr -- > fp->_wide_data->_IO_write_base) -- || _IO_in_put_mode (fp)); -- -- if (mode == 0) -+ /* No point looking for offsets in the buffer if it hasn't even been -+ allocated. */ -+ if (fp->_wide_data->_IO_buf_base != NULL) - { -+ const wchar_t *wide_read_base; -+ const wchar_t *wide_read_ptr; -+ const wchar_t *wide_read_end; -+ bool was_writing = ((fp->_wide_data->_IO_write_ptr -+ > fp->_wide_data->_IO_write_base) -+ || _IO_in_put_mode (fp)); -+ - /* XXX For wide stream with backup store it is not very - reasonable to determine the offset. The pushed-back - character might require a state change and we need not be -@@ -633,14 +626,117 @@ _IO_wfile_seekoff (fp, offset, dir, mode) - return -1; - } - -- /* There is no more data in the backup buffer. We can -- switch back. */ -- _IO_switch_to_main_wget_area (fp); -+ /* Nothing in the backup store, so note the backed up pointers -+ without changing the state. */ -+ wide_read_base = fp->_wide_data->_IO_save_base; -+ wide_read_ptr = wide_read_base; -+ wide_read_end = fp->_wide_data->_IO_save_end; -+ } -+ else -+ { -+ wide_read_base = fp->_wide_data->_IO_read_base; -+ wide_read_ptr = fp->_wide_data->_IO_read_ptr; -+ wide_read_end = fp->_wide_data->_IO_read_end; - } - -- dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */ -+ struct _IO_codecvt *cv = fp->_codecvt; -+ int clen = (*cv->__codecvt_do_encoding) (cv); -+ -+ if (!was_writing) -+ { -+ if (clen > 0) -+ { -+ offset -= (wide_read_end - wide_read_ptr) * clen; -+ offset -= fp->_IO_read_end - fp->_IO_read_ptr; -+ } -+ else -+ { -+ int nread; -+ -+ size_t delta = wide_read_ptr - wide_read_base; -+ __mbstate_t state = fp->_wide_data->_IO_last_state; -+ nread = (*cv->__codecvt_do_length) (cv, &state, -+ fp->_IO_read_base, -+ fp->_IO_read_end, delta); -+ offset -= fp->_IO_read_end - fp->_IO_read_base - nread; -+ } -+ } -+ else -+ { -+ if (clen > 0) -+ offset += (fp->_wide_data->_IO_write_ptr -+ - fp->_wide_data->_IO_write_base) * clen; -+ else -+ { -+ size_t delta = (fp->_wide_data->_IO_write_ptr -+ - fp->_wide_data->_IO_write_base); -+ -+ /* Allocate enough space for the conversion. */ -+ size_t outsize = delta * sizeof (wchar_t); -+ char *out = malloc (outsize); -+ char *outstop = out; -+ const wchar_t *in = fp->_wide_data->_IO_write_base; -+ -+ enum __codecvt_result status; -+ -+ __mbstate_t state = fp->_wide_data->_IO_last_state; -+ status = (*cv->__codecvt_do_out) (cv, &state, -+ in, in + delta, &in, -+ out, out + outsize, &outstop); -+ -+ /* We don't check for __codecvt_partial because it can be -+ returned on one of two conditions: either the output -+ buffer is full or the input sequence is incomplete. We -+ take care to allocate enough buffer and our input -+ sequences must be complete since they are accepted as -+ wchar_t; if not, then that is an error. */ -+ if (__glibc_unlikely (status != __codecvt_ok)) -+ return WEOF; -+ -+ offset += outstop - out; -+ } -+ -+ /* _IO_read_end coincides with fp._offset, so the actual file position -+ is fp._offset - (_IO_read_end - new_write_ptr). */ -+ offset -= fp->_IO_read_end - fp->_IO_write_ptr; -+ } - } - -+ result = get_file_offset (fp); -+ -+ if (result == EOF) -+ return result; -+ -+ result += offset; -+ -+ return result; -+} -+ -+_IO_off64_t -+_IO_wfile_seekoff (fp, offset, dir, mode) -+ _IO_FILE *fp; -+ _IO_off64_t offset; -+ int dir; -+ int mode; -+{ -+ _IO_off64_t result; -+ _IO_off64_t delta, new_offset; -+ long int count; -+ -+ if (mode == 0) -+ return do_ftell_wide (fp); -+ -+ /* POSIX.1 8.2.3.7 says that after a call the fflush() the file -+ offset of the underlying file must be exact. */ -+ int must_be_exact = ((fp->_wide_data->_IO_read_base -+ == fp->_wide_data->_IO_read_end) -+ && (fp->_wide_data->_IO_write_base -+ == fp->_wide_data->_IO_write_ptr)); -+ -+ bool was_writing = ((fp->_wide_data->_IO_write_ptr -+ > fp->_wide_data->_IO_write_base) -+ || _IO_in_put_mode (fp)); -+ - /* Flush unwritten characters. - (This may do an unneeded write if we seek within the buffer. - But to be able to switch to reading, we would need to set -@@ -648,7 +744,7 @@ _IO_wfile_seekoff (fp, offset, dir, mode) - which assumes file_ptr() is eGptr. Anyway, since we probably - end up flushing when we close(), it doesn't make much difference.) - FIXME: simulate mem-mapped files. */ -- else if (was_writing && _IO_switch_to_wget_mode (fp)) -+ if (was_writing && _IO_switch_to_wget_mode (fp)) - return WEOF; - - if (fp->_wide_data->_IO_buf_base == NULL) -@@ -693,7 +789,6 @@ _IO_wfile_seekoff (fp, offset, dir, mode) - { - int nread; - -- flushed: - delta = (fp->_wide_data->_IO_read_ptr - - fp->_wide_data->_IO_read_base); - fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state; -@@ -706,80 +801,9 @@ _IO_wfile_seekoff (fp, offset, dir, mode) - offset -= fp->_IO_read_end - fp->_IO_read_base - nread; - } - } -- else -- { -- char *new_write_ptr = fp->_IO_write_ptr; -- -- if (clen > 0) -- offset += (fp->_wide_data->_IO_write_ptr -- - fp->_wide_data->_IO_write_base) / clen; -- else -- { -- enum __codecvt_result status = __codecvt_ok; -- delta = (fp->_wide_data->_IO_write_ptr -- - fp->_wide_data->_IO_write_base); -- const wchar_t *write_base = fp->_wide_data->_IO_write_base; -- -- /* FIXME: This actually ends up in two iterations of conversion, -- one here and the next when the buffer actually gets flushed. -- It may be possible to optimize this in future so that -- wdo_write identifies already converted content and does not -- redo it. In any case, this is much better than having to -- flush buffers for every ftell. */ -- do -- { -- /* There is not enough space in the buffer to do the entire -- conversion, so there is no point trying to avoid the -- buffer flush. Just do it and go back to how it was with -- the read mode. */ -- if (status == __codecvt_partial -- || (delta > 0 && new_write_ptr == fp->_IO_buf_end)) -- { -- if (_IO_switch_to_wget_mode (fp)) -- return WEOF; -- goto flushed; -- } -- -- const wchar_t *new_wbase = fp->_wide_data->_IO_write_base; -- fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state; -- status = (*cv->__codecvt_do_out) (cv, -- &fp->_wide_data->_IO_state, -- write_base, -- write_base + delta, -- &new_wbase, -- new_write_ptr, -- fp->_IO_buf_end, -- &new_write_ptr); -- -- delta -= new_wbase - write_base; -- -- /* If there was an error, then return WEOF. -- TODO: set buffer state. */ -- if (__glibc_unlikely (status == __codecvt_error)) -- return WEOF; -- } -- while (delta > 0); -- } -- -- /* _IO_read_end coincides with fp._offset, so the actual file position -- is fp._offset - (_IO_read_end - new_write_ptr). This is fine -- even if fp._offset is not set, since fp->_IO_read_end is then at -- _IO_buf_base and this adjustment is for unbuffered output. */ -- offset -= fp->_IO_read_end - new_write_ptr; -- } - - if (fp->_offset == _IO_pos_BAD) -- { -- if (mode != 0) -- goto dumb; -- else -- { -- result = _IO_SYSSEEK (fp, 0, dir); -- if (result == EOF) -- return result; -- fp->_offset = result; -- } -- } -+ goto dumb; - - /* Make offset absolute, assuming current pointer is file_ptr(). */ - offset += fp->_offset; -@@ -802,10 +826,6 @@ _IO_wfile_seekoff (fp, offset, dir, mode) - } - /* At this point, dir==_IO_seek_set. */ - -- /* If we are only interested in the current position we've found it now. */ -- if (mode == 0) -- return offset; -- - /* If destination is within current buffer, optimize: */ - if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL - && !_IO_in_backup (fp)) diff --git a/glibc-rh1069559-2.patch b/glibc-rh1069559-2.patch deleted file mode 100644 index b74e2f1..0000000 --- a/glibc-rh1069559-2.patch +++ /dev/null @@ -1,183 +0,0 @@ -commit 4a68e8ded4fef2b00fbfc6baf1e79e46389871ca -Author: Siddhesh Poyarekar -Date: Thu Feb 20 15:55:16 2014 +0530 - - Use cached offset in ftell when reliable - - The cached offset is reliable to use in ftell when the stream handle - is active. We can consider a stream as being active when there is - unbuffered data. However, even in this case, we can use the cached - offset only when the stream is not being written to in a+ mode, - because this case may have unbuffered data and a stale offset; the - previous read could have sent it off somewhere other than the end of - the file. - - There were a couple of adjustments necessary to get this to work. - Firstly, fdopen now ceases to use _IO_attach_fd because it sets the - offset cache to the current file position. This is not correct - because there could be changes to the file descriptor before the - stream handle is activated, which would not get reflected. - - A similar offset caching action is done in _IO_fwide, claiming that - wide streams have 'problems' with the file offsets. There don't seem - to be any obvious problems with not having the offset cache available, - other than that it will have to be queried in a subsequent - read/write/seek. I have removed this as well. - - The testsuite passes successfully with these changes on x86_64. - -diff --git a/libio/fileops.c b/libio/fileops.c -index a177302..c44a5da 100644 ---- a/libio/fileops.c -+++ b/libio/fileops.c -@@ -952,12 +952,8 @@ get_file_offset (_IO_FILE *fp) - static _IO_off64_t - do_ftell (_IO_FILE *fp) - { -- _IO_off64_t result; -- -- result = get_file_offset (fp); -- -- if (result == EOF) -- return result; -+ _IO_off64_t result = 0; -+ bool use_cached_offset = false; - - /* No point looking at unflushed data if we haven't allocated buffers - yet. */ -@@ -971,8 +967,34 @@ do_ftell (_IO_FILE *fp) - result -= fp->_IO_read_end - fp->_IO_read_ptr; - else - result += fp->_IO_write_ptr - fp->_IO_read_end; -+ -+ /* It is safe to use the cached offset when available if there is -+ unbuffered data (indicating that the file handle is active) and the -+ handle is not for a file open in a+ mode. The latter condition is -+ because there could be a scenario where there is a switch from read -+ mode to write mode using an fseek to an arbitrary position. In this -+ case, there would be unbuffered data due to be appended to the end of -+ the file, but the offset may not necessarily be the end of the -+ file. It is fine to use the cached offset when the a+ stream is in -+ read mode though, since the offset is maintained correctly in that -+ case. Note that this is not a comprehensive set of cases when the -+ offset is reliable. The offset may be reliable even in some cases -+ where there is no buffered input and the handle is active, but it's -+ just that we don't have a way to identify that condition reliably. */ -+ use_cached_offset = (result != 0 && fp->_offset != _IO_pos_BAD -+ && ((fp->_flags & (_IO_IS_APPENDING | _IO_NO_READS)) -+ == (_IO_IS_APPENDING | _IO_NO_READS) -+ && was_writing)); - } - -+ if (use_cached_offset) -+ result += fp->_offset; -+ else -+ result += get_file_offset (fp); -+ -+ if (result == EOF) -+ return result; -+ - if (result < 0) - { - __set_errno (EINVAL); -diff --git a/libio/iofdopen.c b/libio/iofdopen.c -index 066ff19..4525f0f 100644 ---- a/libio/iofdopen.c -+++ b/libio/iofdopen.c -@@ -141,9 +141,6 @@ _IO_new_fdopen (fd, mode) - #ifdef _IO_MTSAFE_IO - new_f->fp.file._lock = &new_f->lock; - #endif -- /* Set up initially to use the `maybe_mmap' jump tables rather than using -- __fopen_maybe_mmap to do it, because we need them in place before we -- call _IO_file_attach or else it will allocate a buffer immediately. */ - _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, - #ifdef _G_HAVE_MMAP - (use_mmap && (read_write & _IO_NO_WRITES)) -@@ -159,13 +156,10 @@ _IO_new_fdopen (fd, mode) - #if !_IO_UNIFIED_JUMPTABLES - new_f->fp.vtable = NULL; - #endif -- if (_IO_file_attach ((_IO_FILE *) &new_f->fp, fd) == NULL) -- { -- _IO_setb (&new_f->fp.file, NULL, NULL, 0); -- _IO_un_link (&new_f->fp); -- free (new_f); -- return NULL; -- } -+ /* We only record the fd because _IO_file_init will have unset the offset. -+ We don't need to get the current offset in the file now since it could -+ change between now and when the handle is activated. */ -+ new_f->fp.file._fileno = fd; - new_f->fp.file._flags &= ~_IO_DELETE_DONT_CLOSE; - - _IO_mask_flags (&new_f->fp.file, read_write, -diff --git a/libio/iofwide.c b/libio/iofwide.c -index 5cff632..64187e4 100644 ---- a/libio/iofwide.c -+++ b/libio/iofwide.c -@@ -199,12 +199,6 @@ _IO_fwide (fp, mode) - - /* From now on use the wide character callback functions. */ - ((struct _IO_FILE_plus *) fp)->vtable = fp->_wide_data->_wide_vtable; -- -- /* One last twist: we get the current stream position. The wide -- char streams have much more problems with not knowing the -- current position and so we should disable the optimization -- which allows the functions without knowing the position. */ -- fp->_offset = _IO_SYSSEEK (fp, 0, _IO_seek_cur); - } - - /* Set the mode now. */ -diff --git a/libio/wfileops.c b/libio/wfileops.c -index eda7828..651f5ce 100644 ---- a/libio/wfileops.c -+++ b/libio/wfileops.c -@@ -600,6 +600,7 @@ static _IO_off64_t - do_ftell_wide (_IO_FILE *fp) - { - _IO_off64_t result, offset = 0; -+ bool use_cached_offset = false; - - /* No point looking for offsets in the buffer if it hasn't even been - allocated. */ -@@ -696,13 +697,36 @@ do_ftell_wide (_IO_FILE *fp) - offset += outstop - out; - } - -- /* _IO_read_end coincides with fp._offset, so the actual file position -- is fp._offset - (_IO_read_end - new_write_ptr). */ -+ /* _IO_read_end coincides with fp._offset, so the actual file -+ position is fp._offset - (_IO_read_end - new_write_ptr). */ - offset -= fp->_IO_read_end - fp->_IO_write_ptr; -+ - } -+ -+ /* It is safe to use the cached offset when available if there is -+ unbuffered data (indicating that the file handle is active) and -+ the handle is not for a file open in a+ mode. The latter -+ condition is because there could be a scenario where there is a -+ switch from read mode to write mode using an fseek to an arbitrary -+ position. In this case, there would be unbuffered data due to be -+ appended to the end of the file, but the offset may not -+ necessarily be the end of the file. It is fine to use the cached -+ offset when the a+ stream is in read mode though, since the offset -+ is maintained correctly in that case. Note that this is not a -+ comprehensive set of cases when the offset is reliable. The -+ offset may be reliable even in some cases where there is no -+ buffered input and the handle is active, but it's just that we -+ don't have a way to identify that condition reliably. */ -+ use_cached_offset = (offset != 0 && fp->_offset != _IO_pos_BAD -+ && ((fp->_flags & (_IO_IS_APPENDING | _IO_NO_READS)) -+ == (_IO_IS_APPENDING | _IO_NO_READS) -+ && was_writing)); - } - -- result = get_file_offset (fp); -+ if (use_cached_offset) -+ result = fp->_offset; -+ else -+ result = get_file_offset (fp); - - if (result == EOF) - return result; diff --git a/glibc-rh1252570.patch b/glibc-rh1252570.patch deleted file mode 100644 index a35679c..0000000 --- a/glibc-rh1252570.patch +++ /dev/null @@ -1,393 +0,0 @@ -Revert this upstream commit: - -commit 2212c1420c92a33b0e0bd9a34938c9814a56c0f7 -Author: Andreas Schwab -Date: Thu Feb 19 15:52:08 2015 +0100 - - Simplify handling of nameserver configuration in resolver - - Remove use of ext.nsmap member of struct __res_state and always use - an identity mapping betwen the nsaddr_list array and the ext.nsaddrs - array. The fact that a nameserver has an IPv6 address is signalled by - setting nsaddr_list[].sin_family to zero. - -reverted: -Index: glibc-2.23-276-gb65b205/resolv/res_init.c -=================================================================== ---- glibc-2.23-276-gb65b205.orig/resolv/res_init.c -+++ glibc-2.23-276-gb65b205/resolv/res_init.c -@@ -122,8 +122,8 @@ __res_vinit(res_state statp, int preinit - char *cp, **pp; - int n; - char buf[BUFSIZ]; -- int nserv = 0; /* number of nameservers read from file */ -- int have_serv6 = 0; -+ int nserv = 0; /* number of IPv4 nameservers read from file */ -+ int nservall = 0; /* number of (IPv4 + IPV6) nameservers read from file */ - int haveenv = 0; - int havesearch = 0; - int nsort = 0; -@@ -145,9 +145,15 @@ __res_vinit(res_state statp, int preinit - statp->_flags = 0; - statp->qhook = NULL; - statp->rhook = NULL; -+ statp->_u._ext.nsinit = 0; - statp->_u._ext.nscount = 0; -- for (n = 0; n < MAXNS; n++) -- statp->_u._ext.nsaddrs[n] = NULL; -+#ifdef _LIBC -+ statp->_u._ext.nscount6 = 0; -+ for (n = 0; n < MAXNS; n++) { -+ statp->_u._ext.nsaddrs[n] = NULL; -+ statp->_u._ext.nsmap[n] = MAXNS; -+ } -+#endif - - /* Allow user to override the local domain definition */ - if ((cp = getenv("LOCALDOMAIN")) != NULL) { -@@ -251,7 +257,11 @@ __res_vinit(res_state statp, int preinit - continue; - } - /* read nameservers to query */ -+#ifdef _LIBC -+ if (MATCH(buf, "nameserver") && nservall < MAXNS) { -+#else - if (MATCH(buf, "nameserver") && nserv < MAXNS) { -+#endif - struct in_addr a; - - cp = buf + sizeof("nameserver") - 1; -@@ -259,11 +269,12 @@ __res_vinit(res_state statp, int preinit - cp++; - if ((*cp != '\0') && (*cp != '\n') - && __inet_aton(cp, &a)) { -- statp->nsaddr_list[nserv].sin_addr = a; -- statp->nsaddr_list[nserv].sin_family = AF_INET; -- statp->nsaddr_list[nserv].sin_port = -+ statp->nsaddr_list[nservall].sin_addr = a; -+ statp->nsaddr_list[nservall].sin_family = AF_INET; -+ statp->nsaddr_list[nservall].sin_port = - htons(NAMESERVER_PORT); - nserv++; -+ nservall++; - } else { - struct in6_addr a6; - char *el; -@@ -305,11 +316,10 @@ __res_vinit(res_state statp, int preinit - } - } - -- statp->nsaddr_list[nserv].sin_family = 0; -- statp->_u._ext.nsaddrs[nserv] = sa6; -- statp->_u._ext.nssocks[nserv] = -1; -- have_serv6 = 1; -- nserv++; -+ statp->_u._ext.nsaddrs[nservall] = sa6; -+ statp->_u._ext.nssocks[nservall] = -1; -+ statp->_u._ext.nsmap[nservall] = MAXNS + 1; -+ nservall++; - } - } - } -@@ -361,8 +371,9 @@ __res_vinit(res_state statp, int preinit - continue; - } - } -- statp->nscount = nserv; -- if (have_serv6) { -+ statp->nscount = nservall; -+ if (nservall - nserv > 0) { -+ statp->_u._ext.nscount6 = nservall - nserv; - /* We try IPv6 servers again. */ - statp->ipv6_unavail = false; - } -@@ -532,6 +543,8 @@ __res_iclose(res_state statp, bool free_ - statp->_u._ext.nsaddrs[ns] = NULL; - } - } -+ if (free_addr) -+ statp->_u._ext.nsinit = 0; - } - libc_hidden_def (__res_iclose) - -Index: glibc-2.23-276-gb65b205/resolv/res_send.c -=================================================================== ---- glibc-2.23-276-gb65b205.orig/resolv/res_send.c -+++ glibc-2.23-276-gb65b205/resolv/res_send.c -@@ -188,7 +188,6 @@ evNowTime(struct timespec *res) { - - /* Forward. */ - --static struct sockaddr *get_nsaddr (res_state, int); - static int send_vc(res_state, const u_char *, int, - const u_char *, int, - u_char **, int *, int *, int, u_char **, -@@ -226,21 +225,20 @@ res_ourserver_p(const res_state statp, c - in_port_t port = in4p->sin_port; - in_addr_t addr = in4p->sin_addr.s_addr; - -- for (ns = 0; ns < statp->nscount; ns++) { -+ for (ns = 0; ns < MAXNS; ns++) { - const struct sockaddr_in *srv = -- (struct sockaddr_in *) get_nsaddr (statp, ns); -+ (struct sockaddr_in *)EXT(statp).nsaddrs[ns]; - -- if ((srv->sin_family == AF_INET) && -+ if ((srv != NULL) && (srv->sin_family == AF_INET) && - (srv->sin_port == port) && - (srv->sin_addr.s_addr == INADDR_ANY || - srv->sin_addr.s_addr == addr)) - return (1); - } - } else if (inp->sin6_family == AF_INET6) { -- for (ns = 0; ns < statp->nscount; ns++) { -- const struct sockaddr_in6 *srv -- = (struct sockaddr_in6 *) get_nsaddr (statp, ns); -- if ((srv->sin6_family == AF_INET6) && -+ for (ns = 0; ns < MAXNS; ns++) { -+ const struct sockaddr_in6 *srv = EXT(statp).nsaddrs[ns]; -+ if ((srv != NULL) && (srv->sin6_family == AF_INET6) && - (srv->sin6_port == inp->sin6_port) && - !(memcmp(&srv->sin6_addr, &in6addr_any, - sizeof (struct in6_addr)) && -@@ -392,48 +390,80 @@ __libc_res_nsend(res_state statp, const - * If the ns_addr_list in the resolver context has changed, then - * invalidate our cached copy and the associated timing data. - */ -- if (EXT(statp).nscount != 0) { -+ if (EXT(statp).nsinit) { - int needclose = 0; - - if (EXT(statp).nscount != statp->nscount) - needclose++; - else -- for (ns = 0; ns < statp->nscount; ns++) { -- if (statp->nsaddr_list[ns].sin_family != 0 -+ for (ns = 0; ns < MAXNS; ns++) { -+ unsigned int map = EXT(statp).nsmap[ns]; -+ if (map < MAXNS - && !sock_eq((struct sockaddr_in6 *) -- &statp->nsaddr_list[ns], -+ &statp->nsaddr_list[map], - EXT(statp).nsaddrs[ns])) - { - needclose++; - break; - } - } -- if (needclose) { -+ if (needclose) - __res_iclose(statp, false); -- EXT(statp).nscount = 0; -- } - } - - /* - * Maybe initialize our private copy of the ns_addr_list. - */ -- if (EXT(statp).nscount == 0) { -- for (ns = 0; ns < statp->nscount; ns++) { -- EXT(statp).nssocks[ns] = -1; -- if (statp->nsaddr_list[ns].sin_family == 0) -- continue; -- if (EXT(statp).nsaddrs[ns] == NULL) -- EXT(statp).nsaddrs[ns] = -+ if (EXT(statp).nsinit == 0) { -+ unsigned char map[MAXNS]; -+ -+ memset (map, MAXNS, sizeof (map)); -+ for (n = 0; n < MAXNS; n++) { -+ ns = EXT(statp).nsmap[n]; -+ if (ns < statp->nscount) -+ map[ns] = n; -+ else if (ns < MAXNS) { -+ free(EXT(statp).nsaddrs[n]); -+ EXT(statp).nsaddrs[n] = NULL; -+ EXT(statp).nsmap[n] = MAXNS; -+ } -+ } -+ n = statp->nscount; -+ if (statp->nscount > EXT(statp).nscount) -+ for (n = EXT(statp).nscount, ns = 0; -+ n < statp->nscount; n++) { -+ while (ns < MAXNS -+ && EXT(statp).nsmap[ns] != MAXNS) -+ ns++; -+ if (ns == MAXNS) -+ break; -+ /* NS never exceeds MAXNS, but gcc 4.9 somehow -+ does not see this. */ -+ DIAG_PUSH_NEEDS_COMMENT; -+ DIAG_IGNORE_NEEDS_COMMENT (4.9, -+ "-Warray-bounds"); -+ EXT(statp).nsmap[ns] = n; -+ DIAG_POP_NEEDS_COMMENT; -+ map[n] = ns++; -+ } -+ EXT(statp).nscount = n; -+ for (ns = 0; ns < EXT(statp).nscount; ns++) { -+ n = map[ns]; -+ if (EXT(statp).nsaddrs[n] == NULL) -+ EXT(statp).nsaddrs[n] = - malloc(sizeof (struct sockaddr_in6)); -- if (EXT(statp).nsaddrs[ns] != NULL) -- memset (mempcpy(EXT(statp).nsaddrs[ns], -+ if (EXT(statp).nsaddrs[n] != NULL) { -+ memset (mempcpy(EXT(statp).nsaddrs[n], - &statp->nsaddr_list[ns], - sizeof (struct sockaddr_in)), - '\0', - sizeof (struct sockaddr_in6) - - sizeof (struct sockaddr_in)); -+ EXT(statp).nssocks[n] = -1; -+ n++; -+ } - } -- EXT(statp).nscount = statp->nscount; -+ EXT(statp).nsinit = 1; - } - - /* -@@ -442,37 +472,44 @@ __libc_res_nsend(res_state statp, const - */ - if (__builtin_expect ((statp->options & RES_ROTATE) != 0, 0) && - (statp->options & RES_BLAST) == 0) { -- struct sockaddr_in ina; -- struct sockaddr_in6 *inp; -- int lastns = statp->nscount - 1; -- int fd; -- -- inp = EXT(statp).nsaddrs[0]; -- ina = statp->nsaddr_list[0]; -- fd = EXT(statp).nssocks[0]; -- for (ns = 0; ns < lastns; ns++) { -- EXT(statp).nsaddrs[ns] = EXT(statp).nsaddrs[ns + 1]; -- statp->nsaddr_list[ns] = statp->nsaddr_list[ns + 1]; -- EXT(statp).nssocks[ns] = EXT(statp).nssocks[ns + 1]; -- } -- EXT(statp).nsaddrs[lastns] = inp; -- statp->nsaddr_list[lastns] = ina; -- EXT(statp).nssocks[lastns] = fd; -+ struct sockaddr_in6 *ina; -+ unsigned int map; -+ -+ n = 0; -+ while (n < MAXNS && EXT(statp).nsmap[n] == MAXNS) -+ n++; -+ if (n < MAXNS) { -+ ina = EXT(statp).nsaddrs[n]; -+ map = EXT(statp).nsmap[n]; -+ for (;;) { -+ ns = n + 1; -+ while (ns < MAXNS -+ && EXT(statp).nsmap[ns] == MAXNS) -+ ns++; -+ if (ns == MAXNS) -+ break; -+ EXT(statp).nsaddrs[n] = EXT(statp).nsaddrs[ns]; -+ EXT(statp).nsmap[n] = EXT(statp).nsmap[ns]; -+ n = ns; -+ } -+ EXT(statp).nsaddrs[n] = ina; -+ EXT(statp).nsmap[n] = map; -+ } - } - - /* - * Send request, RETRY times, or until successful. - */ - for (try = 0; try < statp->retry; try++) { -- for (ns = 0; ns < statp->nscount; ns++) -+ for (ns = 0; ns < MAXNS; ns++) - { - #ifdef DEBUG - char tmpbuf[40]; - #endif --#if defined USE_HOOKS || defined DEBUG -- struct sockaddr *nsap = get_nsaddr (statp, ns); --#endif -+ struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns]; - -+ if (nsap == NULL) -+ goto next_ns; - same_ns: - #ifdef USE_HOOKS - if (__glibc_unlikely (statp->qhook != NULL)) { -@@ -629,21 +666,6 @@ libresolv_hidden_def (res_nsend) - - /* Private */ - --static struct sockaddr * --get_nsaddr (res_state statp, int n) --{ -- -- if (statp->nsaddr_list[n].sin_family == 0 && EXT(statp).nsaddrs[n] != NULL) -- /* EXT(statp).nsaddrs[n] holds an address that is larger than -- struct sockaddr, and user code did not update -- statp->nsaddr_list[n]. */ -- return (struct sockaddr *) EXT(statp).nsaddrs[n]; -- else -- /* User code updated statp->nsaddr_list[n], or statp->nsaddr_list[n] -- has the same content as EXT(statp).nsaddrs[n]. */ -- return (struct sockaddr *) (void *) &statp->nsaddr_list[n]; --} -- - /* Close the resolver structure, assign zero to *RESPLEN2 if RESPLEN2 - is not NULL, and return zero. */ - static int -@@ -737,7 +759,7 @@ send_vc(res_state statp, - const HEADER *hp = (HEADER *) buf; - const HEADER *hp2 = (HEADER *) buf2; - HEADER *anhp = (HEADER *) *ansp; -- struct sockaddr *nsap = get_nsaddr (statp, ns); -+ struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns]; - int truncating, connreset, n; - /* On some architectures compiler might emit a warning indicating - 'resplen' may be used uninitialized. However if buf2 == NULL -@@ -768,8 +790,8 @@ send_vc(res_state statp, - - if (getpeername(statp->_vcsock, - (struct sockaddr *)&peer, &size) < 0 || -- !sock_eq(&peer, (struct sockaddr_in6 *) nsap)) { -- __res_iclose(statp, false); -+ !sock_eq(&peer, nsap)) { -+ __res_iclose(statp, false); - statp->_flags &= ~RES_F_VC; - } - } -@@ -778,7 +800,7 @@ send_vc(res_state statp, - if (statp->_vcsock >= 0) - __res_iclose(statp, false); - -- statp->_vcsock = socket(nsap->sa_family, SOCK_STREAM, 0); -+ statp->_vcsock = socket(nsap->sin6_family, SOCK_STREAM, 0); - if (statp->_vcsock < 0) { - *terrno = errno; - Perror(statp, stderr, "socket(vc)", errno); -@@ -787,12 +809,13 @@ send_vc(res_state statp, - return (-1); - } - __set_errno (0); -- if (connect(statp->_vcsock, nsap, -- nsap->sa_family == AF_INET -+ if (connect(statp->_vcsock, (struct sockaddr *)nsap, -+ nsap->sin6_family == AF_INET - ? sizeof (struct sockaddr_in) - : sizeof (struct sockaddr_in6)) < 0) { - *terrno = errno; -- Aerror(statp, stderr, "connect/vc", errno, nsap); -+ Aerror(statp, stderr, "connect/vc", errno, -+ (struct sockaddr *) nsap); - return close_and_return_error (statp, resplen2); - } - statp->_flags |= RES_F_VC; -@@ -983,7 +1006,8 @@ static int - reopen (res_state statp, int *terrno, int ns) - { - if (EXT(statp).nssocks[ns] == -1) { -- struct sockaddr *nsap = get_nsaddr (statp, ns); -+ struct sockaddr *nsap -+ = (struct sockaddr *) EXT(statp).nsaddrs[ns]; - socklen_t slen; - - /* only try IPv6 if IPv6 NS and if not failed before */ diff --git a/template.patch b/template.patch deleted file mode 100644 index 86e99b9..0000000 --- a/template.patch +++ /dev/null @@ -1,11 +0,0 @@ -Short description: -Author(s): -Origin: -# Likely git://sourceware.org/git/glibc.git -Bug-RHEL: -Bug-Fedora: -Bug-Upstream: -Upstream status: <[Patchwork URL|not-needed|not-submitted|committed] for each commit> -# - -