From patchwork Tue Jul 23 15:43:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Henrik_Lindstr=C3=B6m?= X-Patchwork-Id: 1963950 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lxm.se header.i=@lxm.se header.a=rsa-sha256 header.s=loopiadkim1708025221 header.b=MghcO58y; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WT1f60pKGz1yZw for ; Wed, 24 Jul 2024 01:43:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 82B45386182E for ; Tue, 23 Jul 2024 15:43:55 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtp.outgoing.loopia.se (smtp.outgoing.loopia.se [93.188.3.37]) by sourceware.org (Postfix) with ESMTPS id 7F989385DC1E for ; Tue, 23 Jul 2024 15:43:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F989385DC1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lxm.se Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lxm.se ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7F989385DC1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=93.188.3.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721749421; cv=none; b=rWlrXEsy1qJpis3sRCfH1MULHNHeZAjRTnfJaivJEH7TBnJJm/wGIEIoq9opYGyaeoUVhmLGPu7lwlZ2aPYnAef3tICY1s45eYoG7EY5LdiCNZpJp+1v3PbJ4Z4U657uAm12Nrf78luehYCclxjWI4BzdcCMLf5yubrhhZrbrSM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721749421; c=relaxed/simple; bh=D0uFmFr1iSKWRhLX6D5P72Go+OxXkQWBdy7ygtr3A7w=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=kld6MXXqcA71d7snuPeJyygBcKczfFstI9zUgbiBpgOHlW4C0hHYMBqHiFwoAp1p0L7vS/qx4fJTD1Esc0GDdi4I8iTZAZxUQf0ePDZ+uT3kaInWWqhKSJ0rGDsisbVzeXl4RA4HoAIKueVUuOms8SfQH3QPBGmoF9uM8SvuV2w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id CDD68499A2 for ; Tue, 23 Jul 2024 17:43:36 +0200 (CEST) Received: from s981.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id BA60E4845A for ; Tue, 23 Jul 2024 17:43:36 +0200 (CEST) Received: from s471.loopia.se (unknown [172.22.191.5]) by s981.loopia.se (Postfix) with ESMTP id B8C9522B1761 for ; Tue, 23 Jul 2024 17:43:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Authentication-Results: s471.loopia.se (amavisd-new); dkim=pass (2048-bit key) header.d=lxm.se Received: from s979.loopia.se ([172.22.191.6]) by s471.loopia.se (s471.loopia.se [172.22.190.35]) (amavisd-new, port 10024) with LMTP id 6v7lhVR-cGw1; Tue, 23 Jul 2024 17:43:36 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: henrik@lxm.se X-Loopia-Originating-IP: 92.35.23.126 Received: from pc.arpa.home (c-7e17235c.012-196-6c6b701.bbcust.telenor.se [92.35.23.126]) (Authenticated sender: henrik@lxm.se) by s979.loopia.se (Postfix) with ESMTPSA id 3DEAB10BC46A; Tue, 23 Jul 2024 17:43:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lxm.se; s=loopiadkim1708025221; t=1721749416; bh=pwZ0Zfiowy1CLtEuLz+mcgI1LjmaHWKtOC0YpUaSJCw=; h=From:To:Cc:Subject:Date; b=MghcO58y2jS1Ns74yqobRbnlJmluLFfVMRJ85X6rHXZnbLvXBNn9nqtYXyn3SlloD Y9RiTDMe5t2ypliccea3tbtMLz7EtH7Hv5mwnfJkNiS7mXJxDn4+wOE6XYInYVvobE zf7i/JSA75jDv19fkqWaH2GEbOp1R1jkH5NGEQNtXT3ttaX5V1goP3fsgHoEQD74/F alnmi2l02dFX83lLHHNL3uo3/ZaRkftqX156CLbJVGBVxA+LUqvVols8FACkljEI82 BpkAGvLhFvaSINbvcucr+B9Ggc54MNGfsca/SPkRtVXk9n5IO9stTYFf7wKDsS0LV3 jWr7fVUGKI9SQ== From: =?utf-8?q?Henrik_Lindstr=C3=B6m?= To: libc-alpha@sourceware.org Cc: =?utf-8?q?Henrik_Lindstr=C3=B6m?= Subject: [PATCH] rtld: Fix handling of '--' option Date: Tue, 23 Jul 2024 17:43:22 +0200 Message-Id: <20240723154322.620110-1-henrik@lxm.se> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org It always resulted in the error `unrecognized option '--'` previously. --- elf/rtld.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/elf/rtld.c b/elf/rtld.c index bfdf632e77..7b982c5fe5 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;