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>
This commit is contained in:
parent
8f7415c41b
commit
e9cc95f372
1 changed files with 6 additions and 6 deletions
|
@ -1135,12 +1135,6 @@ int main(int argc, char *argv[])
|
||||||
cleanup(EXIT_FAILURE);
|
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 '-' */
|
/* we support reading targets from stdin if a cmdline parameter is '-' */
|
||||||
if(alpm_list_find_str(pm_targets, "-")) {
|
if(alpm_list_find_str(pm_targets, "-")) {
|
||||||
if(!isatty(fileno(stdin))) {
|
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());
|
pm_printf(ALPM_LOG_DEBUG, "pacman v%s - libalpm v%s\n", PACKAGE_VERSION, alpm_version());
|
||||||
|
|
||||||
/* parse the config file */
|
/* parse the config file */
|
||||||
|
|
Loading…
Add table
Reference in a new issue