diff options
author | Rob Landley <rob@landley.net> | 2019-08-23 10:32:38 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-08-23 10:32:38 -0500 |
commit | 68757a5d54312d6ee47de471a57b4771f7c641ea (patch) | |
tree | 148b4d81ed69885eb5e68fa42e2d093c6816440f | |
parent | 0b3e75699ef2c8a2586d7980cdc736530362475f (diff) | |
download | toybox-68757a5d54312d6ee47de471a57b4771f7c641ea.tar.gz |
Fix "ln -s toybox potato; ./potato" unknown command problem.
(Commit 7771e94e2a08 broke it.)
-rw-r--r-- | main.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |