]> sourceware.org Git - glibc.git/commitdiff
rtld: Fix handling of '--' option
authorHenrik Lindström <henrik@lxm.se>
Fri, 26 Jul 2024 10:33:50 +0000 (12:33 +0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 6 Aug 2024 13:26:17 +0000 (10:26 -0300)
It always resulted in the error `unrecognized option '--'` previously.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
elf/rtld.c

index 09b9c9993b3378bccde4f1d9ad804c20e101b198..1e2e9ad5a8969535b9662cb51132f8e4e3a2720e 100644 (file)
@@ -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;
This page took 0.040812 seconds and 5 git commands to generate.