diff options
author | Ron Yorston <rmy@pobox.com> | 2012-03-22 13:56:39 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-03-22 13:56:39 +0000 |
commit | 811c449748d5bd0505f8510e5582892f94ac0cda (patch) | |
tree | 2640249cb2a9605c7cd59467b9861b205e9bcc8a /libbb/appletlib.c | |
parent | c0d4367d6b581eb5989c02815880cf0fa2851ae8 (diff) | |
parent | 19311bfa7b8e8c6effa9c375de9b0eb4338bee12 (diff) | |
download | busybox-w32-811c449748d5bd0505f8510e5582892f94ac0cda.tar.gz busybox-w32-811c449748d5bd0505f8510e5582892f94ac0cda.tar.bz2 busybox-w32-811c449748d5bd0505f8510e5582892f94ac0cda.zip |
Merge commit '19311bfa7b8e8c6effa9c375de9b0eb4338bee12' into merge
Conflicts:
coreutils/ls.c
shell/ash.c
Diffstat (limited to 'libbb/appletlib.c')
-rw-r--r-- | libbb/appletlib.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 4e32414b4..50e53aa25 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -713,12 +713,22 @@ static int busybox_main(char **argv) | |||
713 | if (ENABLE_FEATURE_INSTALLER && strcmp(argv[1], "--install") == 0) { | 713 | if (ENABLE_FEATURE_INSTALLER && strcmp(argv[1], "--install") == 0) { |
714 | int use_symbolic_links; | 714 | int use_symbolic_links; |
715 | const char *busybox; | 715 | const char *busybox; |
716 | |||
716 | busybox = xmalloc_readlink(bb_busybox_exec_path); | 717 | busybox = xmalloc_readlink(bb_busybox_exec_path); |
717 | if (!busybox) | 718 | if (!busybox) { |
718 | busybox = bb_busybox_exec_path; | 719 | /* bb_busybox_exec_path is usually "/proc/self/exe". |
719 | /* busybox --install [-s] [DIR]: */ | 720 | * In chroot, readlink("/proc/self/exe") usually fails. |
720 | /* -s: make symlinks */ | 721 | * In such case, better use argv[0] as symlink target |
721 | /* DIR: directory to install links to */ | 722 | * if it is a full path name. |
723 | */ | ||
724 | if (argv[0][0] != '/') | ||
725 | bb_error_msg_and_die("'%s' is not an absolute path", argv[0]); | ||
726 | busybox = argv[0]; | ||
727 | } | ||
728 | /* busybox --install [-s] [DIR]: | ||
729 | * -s: make symlinks | ||
730 | * DIR: directory to install links to | ||
731 | */ | ||
722 | use_symbolic_links = (argv[2] && strcmp(argv[2], "-s") == 0 && argv++); | 732 | use_symbolic_links = (argv[2] && strcmp(argv[2], "-s") == 0 && argv++); |
723 | install_links(busybox, use_symbolic_links, argv[2]); | 733 | install_links(busybox, use_symbolic_links, argv[2]); |
724 | return 0; | 734 | return 0; |