mirror of
https://github.com/sheumann/hush.git
synced 2024-12-25 03:32:18 +00:00
improve --install operation in chroot jails
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
7cfe6ea99e
commit
4a2a86d5e7
@ -713,12 +713,23 @@ static int busybox_main(char **argv)
|
|||||||
if (ENABLE_FEATURE_INSTALLER && strcmp(argv[1], "--install") == 0) {
|
if (ENABLE_FEATURE_INSTALLER && strcmp(argv[1], "--install") == 0) {
|
||||||
int use_symbolic_links;
|
int use_symbolic_links;
|
||||||
const char *busybox;
|
const char *busybox;
|
||||||
|
|
||||||
busybox = xmalloc_readlink(bb_busybox_exec_path);
|
busybox = xmalloc_readlink(bb_busybox_exec_path);
|
||||||
if (!busybox)
|
if (!busybox) {
|
||||||
busybox = bb_busybox_exec_path;
|
/* bb_busybox_exec_path is usually "/proc/self/exe".
|
||||||
/* busybox --install [-s] [DIR]: */
|
* In chroot, readlink("/proc/self/exe") usually fails.
|
||||||
/* -s: make symlinks */
|
* In such case, better use argv[0] as symlink target
|
||||||
/* DIR: directory to install links to */
|
* if it is a full path name.
|
||||||
|
*/
|
||||||
|
if (argv[0][0] == '/')
|
||||||
|
busybox = argv[0];
|
||||||
|
else
|
||||||
|
busybox = bb_busybox_exec_path;
|
||||||
|
}
|
||||||
|
/* busybox --install [-s] [DIR]:
|
||||||
|
* -s: make symlinks
|
||||||
|
* DIR: directory to install links to
|
||||||
|
*/
|
||||||
use_symbolic_links = (argv[2] && strcmp(argv[2], "-s") == 0 && argv++);
|
use_symbolic_links = (argv[2] && strcmp(argv[2], "-s") == 0 && argv++);
|
||||||
install_links(busybox, use_symbolic_links, argv[2]);
|
install_links(busybox, use_symbolic_links, argv[2]);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user