From: Henrik Lindström Date: Fri, 26 Jul 2024 10:33:50 +0000 (+0200) Subject: rtld: Fix handling of '--' option X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=2227195794f96c7bf583e9ea4fb929cbedf1d8a1;p=glibc.git rtld: Fix handling of '--' option It always resulted in the error `unrecognized option '--'` previously. Reviewed-by: Adhemerval Zanella --- diff --git a/elf/rtld.c b/elf/rtld.c index 09b9c9993b..1e2e9ad5a8 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1501,12 +1501,16 @@ dl_main (const ElfW(Phdr) *phdr, _dl_version (); else if (_dl_argv[1][0] == '-' && _dl_argv[1][1] == '-') { - if (_dl_argv[1][1] == '\0') - /* End of option list. */ - break; - else - /* Unrecognized option. */ - _dl_usage (ld_so_name, _dl_argv[1]); + if (_dl_argv[1][2] == '\0') + { + /* End of option list. */ + --_dl_argc; + ++_dl_argv; + break; + } + else + /* Unrecognized option. */ + _dl_usage (ld_so_name, _dl_argv[1]); } else break;