+ switch(application_api_pid=fork()) {
+ case 0:
+ cmd = vstralloc(APPLICATION_DIR, "/", dle->program, NULL);
+ k = application_property_argv_size(dle);
+ for (scriptlist = dle->scriptlist; scriptlist != NULL;
+ scriptlist = scriptlist->next) {
+ script = (script_t *)scriptlist->data;
+ if (script->result && script->result->proplist) {
+ k += property_argv_size(script->result->proplist);
+ }
+ }
+ argvchild = g_new0(char *, 20 + k);
+ i=0;
+ argvchild[i++] = dle->program;
+ argvchild[i++] = "backup";
+ if (bsu->message_line == 1) {
+ argvchild[i++] = "--message";
+ argvchild[i++] = "line";
+ }
+ if (g_options->config && bsu->config == 1) {
+ argvchild[i++] = "--config";
+ argvchild[i++] = g_options->config;
+ }
+ if (g_options->hostname && bsu->host == 1) {
+ argvchild[i++] = "--host";
+ argvchild[i++] = g_options->hostname;
+ }
+ if (dle->disk && bsu->disk == 1) {
+ argvchild[i++] = "--disk";
+ argvchild[i++] = dle->disk;
+ }
+ argvchild[i++] = "--device";
+ argvchild[i++] = dle->device;
+ if (level <= bsu->max_level) {
+ argvchild[i++] = "--level";
+ g_snprintf(levelstr,19,"%d",level);
+ argvchild[i++] = levelstr;
+ }
+ if (indexfd != -1 && bsu->index_line == 1) {
+ argvchild[i++] = "--index";
+ argvchild[i++] = "line";
+ }
+ if (dle->record && bsu->record == 1) {
+ argvchild[i++] = "--record";
+ }
+ i += application_property_add_to_argv(&argvchild[i], dle, bsu);
+
+ for (scriptlist = dle->scriptlist; scriptlist != NULL;
+ scriptlist = scriptlist->next) {
+ script = (script_t *)scriptlist->data;
+ if (script->result && script->result->proplist) {
+ i += property_add_to_argv(&argvchild[i],
+ script->result->proplist);
+ }
+ }
+
+ argvchild[i] = NULL;
+ dbprintf(_("%s: running \"%s\n"), get_pname(), cmd);
+ for(j=1;j<i;j++) dbprintf(" %s\n",argvchild[j]);
+ dbprintf(_("\"\n"));
+ if(dup2(dumpout, 1) == -1) {
+ error(_("Can't dup2: %s"),strerror(errno));
+ /*NOTREACHED*/
+ }
+ if (dup2(errfd[1], 2) == -1) {
+ error(_("Can't dup2: %s"),strerror(errno));
+ /*NOTREACHED*/
+ }
+ if(dup2(mesgfd, 3) == -1) {
+ error(_("Can't dup2: %s"),strerror(errno));
+ /*NOTREACHED*/
+ }
+ if(indexfd > 0) {
+ if(dup2(indexfd, 4) == -1) {
+ error(_("Can't dup2: %s"),strerror(errno));
+ /*NOTREACHED*/
+ }
+ fcntl(indexfd, F_SETFD, 0);
+ }
+ application_api_info_tapeheader(mesgfd, dle->program, dle);
+ if (indexfd != 0) {
+ safe_fd(3, 2);
+ } else {
+ safe_fd(3, 1);
+ }
+ execve(cmd, argvchild, safe_env());