Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07C93C3ABD8 for ; Sun, 18 May 2025 12:50:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 99BB8408E8; Sun, 18 May 2025 12:50:00 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id nO1L1A196kRE; Sun, 18 May 2025 12:49:59 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 688A9408CE Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id 688A9408CE; Sun, 18 May 2025 12:49:59 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists1.osuosl.org (Postfix) with ESMTP id B6233DF for ; Sun, 18 May 2025 12:49:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A76326089D for ; Sun, 18 May 2025 12:49:55 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1yOS2AD9xJSF for ; Sun, 18 May 2025 12:49:54 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4b98:dc4:8::227; helo=relay7-d.mail.gandi.net; envelope-from=peko@korsgaard.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 2ED566087F DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2ED566087F Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by smtp3.osuosl.org (Postfix) with ESMTPS id 2ED566087F for ; Sun, 18 May 2025 12:49:53 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id B5A7643941; Sun, 18 May 2025 12:49:51 +0000 (UTC) Received: from peko by dell.be.48ers.dk with local (Exim 4.96) (envelope-from ) id 1uGdSh-00HS67-09; Sun, 18 May 2025 14:49:51 +0200 From: Peter Korsgaard To: buildroot@buildroot.org Date: Sun, 18 May 2025 14:49:47 +0200 Message-Id: <20250518124949.4159568-1-peter@korsgaard.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefudekheeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefrvghtvghrucfmohhrshhgrggrrhguuceophgvthgvrheskhhorhhsghgrrghrugdrtghomheqnecuggftrfgrthhtvghrnhepgfetueffgfeghedvgeetvdejgfefieeitdfhvdeiudegiedthefgfefggedtieeinecuffhomhgrihhnpehophgvnhdqshhtugdrohhrghenucfkphepvdgrtddvmeekgedvrgemgeehrggtmeelgedtudemjeeiugekmeefvghffhemfhgvsgefmeegsggsheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvrgdtvdemkeegvdgrmeeghegrtgemleegtddumeejiegukeemfegvfhhfmehfvggsfeemgegssgehpdhhvghlohepuggvlhhlrdgsvgdrgeekvghrshdrughkpdhmrghilhhfrhhomhepphgvkhhosehkohhrshhgrggrrhgurdgtohhmpdhnsggprhgtphhtthhopeehpdhrtghpthhtohepsghuihhlughrohhothessghuihhlughrohhothdrohhrghdprhgtphhtthhopehpvghtvghrsehkohhrshhgrggrrhgurdgtohhmpdhrtghpthhtohepghhiuhhlihhordgsvghnvghtthhisegsvghnv ghtthhivghnghhinhgvvghrihhnghdrtghomhdprhgtphhtthhopehrohhmrghinhdrnhgrohhurhesghhmrghilhdrtghomhdprhgtphhtthhopehthhhomhgrshdrphgvthgriiiiohhnihessghoohhtlhhinhdrtghomh X-GND-Sasl: peter@korsgaard.com X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=none (p=none dis=none) header.from=korsgaard.com Subject: [Buildroot] [PATCH 1/2] toolchain/toolchain-wrapper.c: slightly simplify cmdline copying X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Naour , Giulio Benetti , Thomas Petazzoni Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" C99 section 5.1.2.2.1p2 mandates that: - argv[argc] shall be a null pointer. https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf So we might as well copy the null pointer along in the memcpy() rather than copy everything up to the null pointer and then add one afterwards for simplicity. Signed-off-by: Peter Korsgaard --- toolchain/toolchain-wrapper.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c index e644c1e7bb..d6ce74fc94 100644 --- a/toolchain/toolchain-wrapper.c +++ b/toolchain/toolchain-wrapper.c @@ -497,12 +497,8 @@ int main(int argc, char **argv) #endif } - /* append forward args */ - memcpy(cur, &argv[1], sizeof(char *) * (argc - 1)); - cur += argc - 1; - - /* finish with NULL termination */ - *cur = NULL; + /* append forward args and terminating NULL */ + memcpy(cur, &argv[1], sizeof(char *) * argc); exec_args = args; #ifdef BR_CCACHE -- 2.39.5 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot