- {
- std::vector<const char *> Args;
- Args.reserve(30);
-
- Args.push_back(gpgvpath.c_str());
- Args.push_back("--status-fd");
- Args.push_back("3");
- Args.push_back("--ignore-time-conflict");
- for (vector<string>::const_iterator K = keyrings.begin();
- K != keyrings.end(); ++K)
- {
- Args.push_back("--keyring");
- Args.push_back(K->c_str());
- }
-
- Configuration::Item const *Opts;
- Opts = _config->Tree("Acquire::gpgv::Options");
- if (Opts != 0)
- {
- Opts = Opts->Child;
- for (; Opts != 0; Opts = Opts->Next)
- {
- if (Opts->Value.empty() == true)
- continue;
- Args.push_back(Opts->Value.c_str());
- }
- }
- Args.push_back(file);
- Args.push_back(outfile);
- Args.push_back(NULL);
-
- if (Debug == true)
- {
- std::clog << "Preparing to exec: " << gpgvpath;
- for(std::vector<const char *>::const_iterator a = Args.begin();*a != NULL; ++a)
- std::clog << " " << *a;
- std::clog << std::endl;
- }
- int const nullfd = open("/dev/null", O_RDONLY);
- close(fd[0]);
- // Redirect output to /dev/null; we read from the status fd
- dup2(nullfd, STDOUT_FILENO);
- dup2(nullfd, STDERR_FILENO);
- // Redirect the pipe to the status fd (3)
- dup2(fd[1], 3);
-
- putenv((char *)"LANG=");
- putenv((char *)"LC_ALL=");
- putenv((char *)"LC_MESSAGES=");
- execvp(gpgvpath.c_str(), (char **) &Args[0]);
-
- exit(111);
- }