Esempio n. 1
0
static void
deb_verify(const char *filename)
{
  struct stat stab;
  pid_t pid;

  if (stat(DEBSIGVERIFY, &stab) < 0)
    return;

  printf(_("Authenticating %s ...\n"), filename);
  fflush(stdout);
  pid = subproc_fork();
  if (!pid) {
    execl(DEBSIGVERIFY, DEBSIGVERIFY, "-q", filename, NULL);
    ohshite(_("unable to execute %s (%s)"),
            _("package signature verification"), DEBSIGVERIFY);
  } else {
    int status;

    status = subproc_wait(pid, "debsig-verify");
    if (!(WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
      if (!fc_badverify)
        ohshit(_("Verification on package %s failed!"), filename);
      else
        fprintf(stderr, _("Verification on package %s failed,\n"
                          "but installing anyway as you requested.\n"),
                filename);
    } else {
      printf(_("passed\n"));
    }
  }
}
Esempio n. 2
0
int
subproc_wait_check(pid_t pid, const char *desc, int flags)
{
	int status;

	status = subproc_wait(pid, desc);

	return subproc_check(status, desc, flags);
}
Esempio n. 3
0
int
subproc_reap(pid_t pid, const char *desc, enum subproc_flags flags)
{
	int status, rc;

	status = subproc_wait(pid, desc);

	if (flags & SUBPROC_NOCHECK)
		rc = status;
	else
		rc = subproc_check(status, desc, flags);

	return rc;
}
Esempio n. 4
0
static bool
deb_reassemble(const char **filename, const char **pfilename)
{
  static char *reasmbuf = NULL;
  struct stat stab;
  int status;
  pid_t pid;

  if (!reasmbuf)
    reasmbuf = dpkg_db_get_path(REASSEMBLETMP);
  if (unlink(reasmbuf) && errno != ENOENT)
    ohshite(_("error ensuring `%.250s' doesn't exist"), reasmbuf);

  push_cleanup(cu_pathname, ~0, NULL, 0, 1, (void *)reasmbuf);

  pid = subproc_fork();
  if (!pid) {
    execlp(SPLITTER, SPLITTER, "-Qao", reasmbuf, *filename, NULL);
    ohshite(_("unable to execute %s (%s)"),
            _("split package reassembly"), SPLITTER);
  }
  status = subproc_wait(pid, SPLITTER);
  switch (WIFEXITED(status) ? WEXITSTATUS(status) : -1) {
  case 0:
    /* It was a part - is it complete? */
    if (!stat(reasmbuf, &stab)) {
      /* Yes. */
      *filename = reasmbuf;
      *pfilename = _("reassembled package file");
      break;
    } else if (errno == ENOENT) {
      /* No. That's it, we skip it. */
      return false;
    }
  case 1:
    /* No, it wasn't a part. */
    break;
  default:
    subproc_check(status, SPLITTER, 0);
  }

  return true;
}
Esempio n. 5
0
void
file_show(const char *filename)
{
	pid_t pid;

	if (filename == NULL)
		internerr("file '%s' does not exist", filename);

	pid = subproc_fork();
	if (pid == 0) {
		struct command cmd;
		const char *pager;

		pager = command_get_pager();

		command_init(&cmd, pager, _("showing file on pager"));
		command_add_arg(&cmd, pager);
		command_add_arg(&cmd, filename);
		command_exec(&cmd);
	}
	subproc_wait(pid, _("showing file on pager"));
}