xbps_file_exec: if chroot(2) returns EPERM, don't error out and try chdir(2).
This makes possible to install a base system with fakeroot (of course some things won't probably work fully).
This commit is contained in:
parent
9759a62e3f
commit
ce24ff488c
15
lib/fexec.c
15
lib/fexec.c
@ -64,11 +64,16 @@ pfcexec(const char *path, const char *file, const char **argv)
|
||||
} else if (path && !do_chroot) {
|
||||
if (chdir(path) == -1)
|
||||
_exit(127);
|
||||
} else if (!path && do_chroot) {
|
||||
if (chroot(".") == -1)
|
||||
_exit(127);
|
||||
if (chdir("/") == -1)
|
||||
_exit(127);
|
||||
} else if (path == NULL && do_chroot) {
|
||||
if (chroot(".") == -1) {
|
||||
if (errno != EPERM)
|
||||
_exit(127);
|
||||
if (chdir(path) == -1)
|
||||
_exit(127);
|
||||
} else {
|
||||
if (chdir("/") == -1)
|
||||
_exit(127);
|
||||
}
|
||||
}
|
||||
|
||||
(void)execv(file, __UNCONST(argv));
|
||||
|
Loading…
Reference in New Issue
Block a user