- bail out early if it fails instead of blindly continuing and potentially
messing in real root (chroot can fail for priviledged user too)
/* Change root directory if requested and not already done. */
rc = rpmpsmNext(psm, PSM_CHROOT_IN);
+ if (rc) break;
if (psm->goal == PSM_PKGINSTALL) {
psm->scriptTag = RPMTAG_PREIN;
{
xx = chdir("/");
if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/')
- rc = chroot(rootDir);
+ if (chroot(rootDir) == -1) {
+ rpmlog(RPMLOG_ERR, _("Unable to change root directory: %m\n"));
+ return -1;
+ }
psm->chrootDone = 1;
(void) rpmtsSetChrootDone(ts, 1);
}