--- rpm-4.4.6/lib/transaction.c.pix 2007-01-08 12:38:41.000000000 +0100 +++ rpm-4.4.6/lib/transaction.c 2007-01-08 13:20:01.000000000 +0100 @@ -2049,8 +2049,18 @@ const char * rootDir = rpmtsRootDir(ts); xx = chdir("/"); /*@-superuser -noeffect @*/ - if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/') + if (rootDir != NULL && strcmp(rootDir, "/") && *rootDir == '/') { xx = chroot(rootDir); + if (xx != 0) { + int err = errno; + struct stat st; + if (Stat(rootDir, &st) >= 0 && S_ISDIR(st.st_mode)) + rpmlog(RPMLOG_CRIT, _("only superuser is allowed to use --root\n")); + else + rpmlog(RPMLOG_CRIT, _("chroot failed, %s: %s\n"), rootDir, strerror(err)); + abort(); + } + } /*@=superuser =noeffect @*/ (void) rpmtsSetChrootDone(ts, 1); }