From 9162c01d09c327ae2e7c3a5148307e8018792c51 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 5 Mar 2015 12:58:49 -0800 Subject: Avoid re-exec-self in bug-setlocale1. --- localedata/bug-setlocale1.c | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'localedata/bug-setlocale1.c') diff --git a/localedata/bug-setlocale1.c b/localedata/bug-setlocale1.c index dc7f6f3f08..546ea7beb8 100644 --- a/localedata/bug-setlocale1.c +++ b/localedata/bug-setlocale1.c @@ -7,44 +7,8 @@ static int -do_test (int argc, char *argv[]) +do_test (void) { - if (argc > 1) - { - char *newargv[5]; - int i; - if (argc != 2 && argc != 5) - { - printf ("wrong number of arguments (%d)\n", argc); - return 1; - } - - for (i = 0; i < (argc == 5 ? 4 : 1); i++) - newargv[i] = argv[i + 1]; - newargv[i] = NULL; - - char *env[3]; - env[0] = (char *) "LC_CTYPE=de_DE.UTF-8"; - char *loc = getenv ("LOCPATH"); - if (loc == NULL || loc[0] == '\0') - { - puts ("LOCPATH not set"); - return 1; - } - asprintf (&env[1], "LOCPATH=%s", loc); - if (env[1] == NULL) - { - puts ("asprintf failed"); - return 1; - } - env[2] = NULL; - - execve (newargv[0], newargv, env); - - puts ("execve returned"); - return 1; - } - int result = 0; char *a = setlocale (LC_ALL, ""); @@ -128,5 +92,5 @@ do_test (int argc, char *argv[]) return result; } -#define TEST_FUNCTION do_test (argc, argv) +#define TEST_FUNCTION do_test () #include "../test-skeleton.c" -- cgit v1.2.3-70-g09d2