diff options
author | Ron Yorston <rmy@pobox.com> | 2024-09-23 12:44:28 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2024-09-27 21:29:05 +0200 |
commit | 24aa93d5382f2365c35d6e804b748e0a1febf2f6 (patch) | |
tree | 626801490ffc84584da3ffcbcef8c62965b740e9 /shell/ash.c | |
parent | 39c5c08b28f14e02611d5c79e357fb7432da1e25 (diff) | |
download | busybox-w32-24aa93d5382f2365c35d6e804b748e0a1febf2f6.tar.gz busybox-w32-24aa93d5382f2365c35d6e804b748e0a1febf2f6.tar.bz2 busybox-w32-24aa93d5382f2365c35d6e804b748e0a1febf2f6.zip |
ash: reject unknown long options
Commit 64f70cc755 (Add --login support) added code in options()
to handle the bash-compatible '--login' option. In doing so it
committed BusyBox ash to silently accepting all other long
options.
Restore compatibility with other ash variants by rejecting unknown
long options.
function old new delta
options 589 624 +35
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r-- | shell/ash.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index bbd730770..8e029765d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -11502,11 +11502,12 @@ options(int *login_sh) | |||
11502 | if (val && (c == '-')) { /* long options */ | 11502 | if (val && (c == '-')) { /* long options */ |
11503 | if (strcmp(p, "login") == 0) { | 11503 | if (strcmp(p, "login") == 0) { |
11504 | *login_sh = 1; | 11504 | *login_sh = 1; |
11505 | break; | ||
11505 | } | 11506 | } |
11506 | /* TODO: --noprofile: e.g. if I want to run emergency shell from sulogin, | 11507 | /* TODO: --noprofile: e.g. if I want to run emergency shell from sulogin, |
11507 | * I want minimal/no shell init scripts - but it insists on running it as "-ash"... | 11508 | * I want minimal/no shell init scripts - but it insists on running it as "-ash"... |
11508 | */ | 11509 | */ |
11509 | break; | 11510 | ash_msg_and_raise_error("bad option '%s'", p - 2); |
11510 | } | 11511 | } |
11511 | } | 11512 | } |
11512 | if (c == 'o') { | 11513 | if (c == 'o') { |