+ GPtrArray *argv_ptr = g_ptr_array_new();
+ guint i;
+ char *cmd = vstralloc(APPLICATION_DIR, "/", dle->program, NULL);
+ GSList *scriptlist;
+ script_t *script;
+ estimatelist_t el;
+ char *cmdline;
+
+ aclose(app_err[0]);
+ dup2(app_err[1], 2);
+
+ g_ptr_array_add(argv_ptr, stralloc(dle->program));
+ g_ptr_array_add(argv_ptr, stralloc("selfcheck"));
+ if (bsu->message_line == 1) {
+ g_ptr_array_add(argv_ptr, stralloc("--message"));
+ g_ptr_array_add(argv_ptr, stralloc("line"));
+ }
+ if (g_options->config != NULL && bsu->config == 1) {
+ g_ptr_array_add(argv_ptr, stralloc("--config"));
+ g_ptr_array_add(argv_ptr, stralloc(g_options->config));
+ }
+ if (g_options->hostname != NULL && bsu->host == 1) {
+ g_ptr_array_add(argv_ptr, stralloc("--host"));
+ g_ptr_array_add(argv_ptr, stralloc(g_options->hostname));
+ }
+ if (dle->disk != NULL && bsu->disk == 1) {
+ g_ptr_array_add(argv_ptr, stralloc("--disk"));
+ g_ptr_array_add(argv_ptr, stralloc(dle->disk));
+ }
+ if (dle->device) {
+ g_ptr_array_add(argv_ptr, stralloc("--device"));
+ g_ptr_array_add(argv_ptr, stralloc(dle->device));
+ }
+ if (dle->create_index && bsu->index_line == 1) {
+ g_ptr_array_add(argv_ptr, stralloc("--index"));
+ g_ptr_array_add(argv_ptr, stralloc("line"));
+ }
+ if (dle->record && bsu->record == 1) {
+ g_ptr_array_add(argv_ptr, stralloc("--record"));
+ }
+
+ for (el = dle->estimatelist; el != NULL; el=el->next) {
+ estimate_t estimate = (estimate_t)GPOINTER_TO_INT(el->data);
+ if (estimate == ES_CALCSIZE && bsu->calcsize == 1) {
+ g_ptr_array_add(argv_ptr, stralloc("--calcsize"));
+ }
+ }
+ application_property_add_to_argv(argv_ptr, dle, bsu,
+ g_options->features);
+
+ for (scriptlist = dle->scriptlist; scriptlist != NULL;
+ scriptlist = scriptlist->next) {
+ script = (script_t *)scriptlist->data;
+ if (script->result && script->result->proplist) {
+ property_add_to_argv(argv_ptr,
+ script->result->proplist);
+ }
+ }
+
+ g_ptr_array_add(argv_ptr, NULL);
+
+ cmdline = stralloc(cmd);
+ for (i = 0; i < argv_ptr->len-1; i++) {
+ char *quoted = quote_string(
+ (char *)g_ptr_array_index(argv_ptr,i));
+ cmdline = vstrextend(&cmdline, " ", quoted, NULL);
+ amfree(quoted);
+ }
+ dbprintf(_("Spawning \"%s\" in pipeline\n"), cmdline);
+ amfree(cmdline);
+
+ safe_fd(-1, 0);
+ execve(cmd, (char **)argv_ptr->pdata, safe_env());
+ g_printf(_("ERROR [Can't execute %s: %s]\n"), cmd, strerror(errno));