From 90ca5e5989ec289a51d2e1c7c8caa59063a6fb70 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 24 Apr 2008 13:23:22 +0300 Subject: [PATCH] Check for chroot() result in rpmtsRun() - bail out early if it fails instead of blindly continuing and potentially messing in real root (chroot can fail for priviledged user too) --- lib/transaction.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/transaction.c b/lib/transaction.c index 702e2f4..2127006 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -1195,7 +1195,10 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/') { /* opening db before chroot not optimal, see rhbz#103852 c#3 */ xx = rpmdbOpenAll(ts->rdb); - xx = chroot(rootDir); + if (chroot(rootDir) == -1) { + rpmlog(RPMLOG_ERR, _("Unable to change root directory: %m\n")); + return -1; + } } (void) rpmtsSetChrootDone(ts, 1); } -- 2.7.4