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
@ -64,12 +64,17 @@ pfcexec(const char *path, const char *file, const char **argv)
|
|||||||
} else if (path && !do_chroot) {
|
} else if (path && !do_chroot) {
|
||||||
if (chdir(path) == -1)
|
if (chdir(path) == -1)
|
||||||
_exit(127);
|
_exit(127);
|
||||||
} else if (!path && do_chroot) {
|
} else if (path == NULL && do_chroot) {
|
||||||
if (chroot(".") == -1)
|
if (chroot(".") == -1) {
|
||||||
|
if (errno != EPERM)
|
||||||
_exit(127);
|
_exit(127);
|
||||||
|
if (chdir(path) == -1)
|
||||||
|
_exit(127);
|
||||||
|
} else {
|
||||||
if (chdir("/") == -1)
|
if (chdir("/") == -1)
|
||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
(void)execv(file, __UNCONST(argv));
|
(void)execv(file, __UNCONST(argv));
|
||||||
_exit(127);
|
_exit(127);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user