Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormorganamilo <morganamilo@archlinux.org>2020-12-31 18:13:55 +0000
committerAllan McRae <allan@archlinux.org>2021-01-11 11:11:06 +1000
commite9cc95f3721967b3cb9f766d400606a8ef4491d0 (patch)
treee5bf8f643da732368eb751b884de26165e690be7 /src
parent8f7415c41b079ede67581a7685a779e427dab440 (diff)
Read targets from stdin before chrooting
Operations involving --sysroot and reading targets from stdin were failing due to attempting to read targets after chrooting. Move the chroot to happen after targets are read. Fixes FS#68630 Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/pacman.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 7b19162c..4fb7fe3c 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -1135,12 +1135,6 @@ int main(int argc, char *argv[])
cleanup(EXIT_FAILURE);
}
- if(config->sysroot && (chroot(config->sysroot) != 0 || chdir("/") != 0)) {
- pm_printf(ALPM_LOG_ERROR,
- _("chroot to '%s' failed: (%s)\n"), config->sysroot, strerror(errno));
- cleanup(EXIT_FAILURE);
- }
-
/* we support reading targets from stdin if a cmdline parameter is '-' */
if(alpm_list_find_str(pm_targets, "-")) {
if(!isatty(fileno(stdin))) {
@@ -1191,6 +1185,12 @@ int main(int argc, char *argv[])
}
}
+ if(config->sysroot && (chroot(config->sysroot) != 0 || chdir("/") != 0)) {
+ pm_printf(ALPM_LOG_ERROR,
+ _("chroot to '%s' failed: (%s)\n"), config->sysroot, strerror(errno));
+ cleanup(EXIT_FAILURE);
+ }
+
pm_printf(ALPM_LOG_DEBUG, "pacman v%s - libalpm v%s\n", PACKAGE_VERSION, alpm_version());
/* parse the config file */