summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2020-11-09 09:03:58 +0200
committerPanu Matilainen <pmatilai@redhat.com>2020-12-10 13:28:07 +0200
commitd8a7e5b36b9fb46488f7e0d6859dbd10fa318ead (patch)
tree60c6e7864ce405f8d34ece40da19c3480977381f
parent4525ea0840d8e5c7a0c8597e09176ca5f2b0870e (diff)
downloadrpm-d8a7e5b36b9fb46488f7e0d6859dbd10fa318ead.tar.gz
Only do early name services initialization if we actually chroot
There's no point or need to do all this fluff on library initialization, we can just as well do it when we're told to use a chroot by calling rpmChrootSet(), at which time we're still on familiar ground. Eliminating unused cruft from initialization can't hurt our start-up times either. (cherry picked from commit f9c7b53f50adc129baee809692d4c80b3bd15432)
-rw-r--r--lib/rpmchroot.c5
-rw-r--r--lib/rpmrc.c5
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/rpmchroot.c b/lib/rpmchroot.c
index 4f2ca77cd..400e285b5 100644
--- a/lib/rpmchroot.c
+++ b/lib/rpmchroot.c
@@ -5,6 +5,7 @@
#include <rpm/rpmstring.h>
#include <rpm/rpmlog.h>
#include "lib/rpmchroot.h"
+#include "lib/rpmug.h"
#include "debug.h"
int _rpm_nouserns = 0;
@@ -101,6 +102,10 @@ int rpmChrootSet(const char *rootDir)
rpmlog(RPMLOG_ERR, _("Unable to open current directory: %m\n"));
rc = -1;
}
+
+ /* Force preloading of dlopen()'ed libraries before chroot */
+ if (rpmugInit())
+ rc = -1;
}
return rc;
diff --git a/lib/rpmrc.c b/lib/rpmrc.c
index 77a8708fb..e707ab238 100644
--- a/lib/rpmrc.c
+++ b/lib/rpmrc.c
@@ -35,7 +35,6 @@
#include "rpmio/rpmlua.h"
#include "rpmio/rpmio_internal.h" /* XXX for rpmioSlurp */
#include "lib/misc.h"
-#include "lib/rpmug.h"
#include "debug.h"
@@ -1632,10 +1631,6 @@ int rpmReadConfigFiles(const char * file, const char * target)
pthread_once(&atexit_registered, register_atexit);
- /* Force preloading of dlopen()'ed libraries in case we go chrooting */
- if (rpmugInit())
- goto exit;
-
if (rpmInitCrypto())
goto exit;