From 2227195794f96c7bf583e9ea4fb929cbedf1d8a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Henrik=20Lindstr=C3=B6m?= Date: Fri, 26 Jul 2024 12:33:50 +0200 Subject: [PATCH] rtld: Fix handling of '--' option It always resulted in the error `unrecognized option '--'` previously. Reviewed-by: Adhemerval Zanella --- elf/rtld.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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; -- 2.43.5