linux-mips
[Top] [All Lists]

[PATCH -queue 2/2] MIPS: Alchemy: use strlcat() for the command line arg

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH -queue 2/2] MIPS: Alchemy: use strlcat() for the command line arguments
From: Yoichi Yuasa <yuasa@linux-mips.org>
Date: Mon, 1 Feb 2010 22:06:56 +0900
Cc: yuasa@linux-mips.org, linux-mips <linux-mips@linux-mips.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:date:from:to:cc :subject:message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=69CEM6EDYmDm+Dr0qFECBU2hdG47WLaz9hbQZjADxow=; b=fa1Bjooy30DntlWJkEiQPHC6M4VcJ1oQlMLYBdRex8hCbehuMzcKi/cp212vo4I2em slOUOGwIMPyiYTxlAyFGvsJsmEpTVpzJRd4BTap8HWw89q9wu10Ixr4d5qp4EKxGzGkB sEjSzw6u6ryMjKlOklb/GQcu5HgMwMIue0IyQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :x-mailer:mime-version:content-type:content-transfer-encoding; b=vby4EJgxc+y7c2plOmtoHrH0nyH6dD8xmnye7A+wwobTj9GG6Xbn1WdLfpzXOzeOSj QDMzytds/tmFiI0r5bxRoeQ4gnLHtkiwfSK/jHsgmUugPvcFi4ozWLLjCAKg8tkrb7Zz 6v0OSSCJ0J5lY1o4V7wLzrGJm6+Md7fZduQM0=
In-reply-to: <20100201220557.729e7061.yuasa@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20100201220557.729e7061.yuasa@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
---
 arch/mips/alchemy/common/prom.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/arch/mips/alchemy/common/prom.c b/arch/mips/alchemy/common/prom.c
index 79e099f..c29511b 100644
--- a/arch/mips/alchemy/common/prom.c
+++ b/arch/mips/alchemy/common/prom.c
@@ -45,22 +45,13 @@ char **prom_envp;
 
 void prom_init_cmdline(void)
 {
-       char *cp;
-       int actr;
-
-       actr = 1; /* Always ignore argv[0] */
+       int i;
 
-       cp = &(arcs_cmdline[0]);
-       while (actr < prom_argc) {
-               strcpy(cp, prom_argv[actr]);
-               cp += strlen(prom_argv[actr]);
-               *cp++ = ' ';
-               actr++;
+       for (i = 1; i < prom_argc; i++) {
+               strlcat(arcs_cmdline, prom_argv[i], COMMAND_LINE_SIZE);
+               if (i < (prom_argc - 1))
+                       strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
        }
-       if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
-               --cp;
-       if (prom_argc > 1)
-               *cp = '\0';
 }
 
 char *prom_getenv(char *envname)
-- 
1.6.6.1


<Prev in Thread] Current Thread [Next in Thread>