rtld: Fix handling of '--' option

It always resulted in the error `unrecognized option '--'` previously.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
Henrik Lindström 2024-07-26 12:33:50 +02:00 committed by Adhemerval Zanella
parent 942670c81d
commit 2227195794

View File

@ -1501,12 +1501,16 @@ dl_main (const ElfW(Phdr) *phdr,
_dl_version (); _dl_version ();
else if (_dl_argv[1][0] == '-' && _dl_argv[1][1] == '-') else if (_dl_argv[1][0] == '-' && _dl_argv[1][1] == '-')
{ {
if (_dl_argv[1][1] == '\0') if (_dl_argv[1][2] == '\0')
/* End of option list. */ {
break; /* End of option list. */
else --_dl_argc;
/* Unrecognized option. */ ++_dl_argv;
_dl_usage (ld_so_name, _dl_argv[1]); break;
}
else
/* Unrecognized option. */
_dl_usage (ld_so_name, _dl_argv[1]);
} }
else else
break; break;