aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-08-23 10:32:38 -0500
committerRob Landley <rob@landley.net>2019-08-23 10:32:38 -0500
commit68757a5d54312d6ee47de471a57b4771f7c641ea (patch)
tree148b4d81ed69885eb5e68fa42e2d093c6816440f
parent0b3e75699ef2c8a2586d7980cdc736530362475f (diff)
downloadtoybox-68757a5d54312d6ee47de471a57b4771f7c641ea.tar.gz
Fix "ln -s toybox potato; ./potato" unknown command problem.
(Commit 7771e94e2a08 broke it.)
-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