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); }
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; }
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; }