aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/main.c b/main.c
index 2b1fdd61..9903b3c5 100644
--- a/main.c
+++ b/main.c
@@ -189,8 +189,12 @@ void toybox_main(void)
// Try dereferencing one layer of symlink
if (toys.argv[1]) {
toy_exec(toys.argv+1);
- if (0<readlink(toys.argv[1], libbuf, sizeof(libbuf)))
- toy_exec_which(toy_find(basename(libbuf)), toys.argv);
+ if (0<readlink(toys.argv[1], libbuf, sizeof(libbuf))) {
+ struct toy_list *tl= toy_find(basename(libbuf));
+
+ if (tl == toy_list) unknown(basename(toys.argv[1]));
+ else toy_exec_which(tl, toys.argv);
+ }
}
// For early error reporting