- argvchild[0] = program;
- argvchild[1] = "selfcheck";
- argvchild[2] = disk;
- argvchild[3] = amdevice;
- argvchild[4] = optstr;
- argvchild[5] = NULL;
+ int j=0;
+ argvchild[j++] = program;
+ argvchild[j++] = "selfcheck";
+ if (bsu->message_line == 1) {
+ argvchild[j++] = "--message";
+ argvchild[j++] = "line";
+ }
+ if (g_options->config != NULL && bsu->config == 1) {
+ argvchild[j++] = "--config";
+ argvchild[j++] = g_options->config;
+ }
+ if (g_options->hostname != NULL && bsu->host == 1) {
+ argvchild[j++] = "--host";
+ argvchild[j++] = g_options->hostname;
+ }
+ if (disk != NULL && bsu->disk == 1) {
+ argvchild[j++] = "--disk";
+ argvchild[j++] = disk;
+ }
+ argvchild[j++] = "--device";
+ argvchild[j++] = amdevice;
+ if(options && options->createindex && bsu->index_line == 1) {
+ argvchild[j++] = "--index";
+ argvchild[j++] = "line";
+ }
+ if (!options->no_record && bsu->record == 1) {
+ argvchild[j++] = "--record";
+ }
+ argvchild[j++] = NULL;
+ dup2(property_pipe[0], 0);
+ aclose(property_pipe[1]);
+ safe_fd(-1, 0);