Don't use ARG_MAX. (#522335, patch by Sebastian Dröge)

2008-03-30  Matthias Clasen  <mclasen@redhat.com>

        * glib/gtester.c: Don't use ARG_MAX.  (#522335, patch by
        Sebastian Dröge)



svn path=/branches/glib-2-16/; revision=6783
This commit is contained in:
Matthias Clasen 2008-03-31 04:25:27 +00:00 committed by Matthias Clasen
parent 6258bfd03d
commit e1d76b4230
2 changed files with 38 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2008-03-30 Matthias Clasen <mclasen@redhat.com>
Merged from trunk:
* glib/gtester.c: Don't use ARG_MAX. (#522335, patch by
Sebastian Dröge)
2008-03-30 Matthias Clasen <mclasen@redhat.com> 2008-03-30 Matthias Clasen <mclasen@redhat.com>
Merged from trunk: Merged from trunk:

View File

@ -273,7 +273,8 @@ launch_test_binary (const char *binary,
GTestLogBuffer *tlb; GTestLogBuffer *tlb;
GSList *slist, *free_list = NULL; GSList *slist, *free_list = NULL;
GError *error = NULL; GError *error = NULL;
const gchar *argv[ARG_MAX]; int argc = 0;
const gchar **argv;
GPid pid = 0; GPid pid = 0;
gint report_pipe[2] = { -1, -1 }; gint report_pipe[2] = { -1, -1 };
guint child_report_cb_id = 0; guint child_report_cb_id = 0;
@ -289,7 +290,34 @@ launch_test_binary (const char *binary,
return FALSE; return FALSE;
} }
/* setup argc */
for (slist = subtest_args; slist; slist = slist->next)
argc++;
/* argc++; */
if (subtest_quiet)
argc++;
if (subtest_verbose)
argc++;
if (!subtest_mode_fatal)
argc++;
if (subtest_mode_quick)
argc++;
else
argc++;
if (subtest_mode_perf)
argc++;
if (gtester_list_tests)
argc++;
if (subtest_seedstr)
argc++;
argc++;
if (skip_tests)
argc++;
for (slist = subtest_paths; slist; slist = slist->next)
argc++;
/* setup argv */ /* setup argv */
argv = g_malloc ((argc + 1) * sizeof(gchar *));
argv[i++] = binary; argv[i++] = binary;
for (slist = subtest_args; slist; slist = slist->next) for (slist = subtest_args; slist; slist = slist->next)
argv[i++] = (gchar*) slist->data; argv[i++] = (gchar*) slist->data;
@ -343,8 +371,10 @@ launch_test_binary (const char *binary,
else else
g_warning ("Failed to execute test binary: %s: %s", argv[0], error->message); g_warning ("Failed to execute test binary: %s: %s", argv[0], error->message);
g_clear_error (&error); g_clear_error (&error);
g_free (argv);
return FALSE; return FALSE;
} }
g_free (argv);
subtest_running = TRUE; subtest_running = TRUE;
subtest_io_pending = TRUE; subtest_io_pending = TRUE;