From 040e5e50f1a24ab296a5288c3b65cfd12a9b66a6 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Mon, 19 Feb 2007 06:57:38 +0000 Subject: [PATCH] fix a kernel clobberer that showed up when running gcc. Was able to successfully build a hello world app with gcc after this. The kernel arg logic was faulty, and wasn't using strlcpy properly (which returns the size of the src string, not the remaining size). Replaced it with a simpler, but less efficient series of strlcat()s. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20162 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/team.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/system/kernel/team.c b/src/system/kernel/team.c index 102ae3d874..e4f2f92018 100644 --- a/src/system/kernel/team.c +++ b/src/system/kernel/team.c @@ -777,23 +777,10 @@ team_create_thread_start(void *args) TRACE(("team_create_thread_start: loading elf binary '%s'\n", path)); // add args to info member - sizeLeft = strlcpy(team->args, path, sizeof(team->args)); - udest = team->args + sizeLeft; - sizeLeft = sizeof(team->args) - sizeLeft; - - for (i = 1; i < argCount && sizeLeft > 2; i++) { - size_t length; - - udest[0] = ' '; - udest++; - sizeLeft--; - - length = strlcpy(udest, teamArgs->args[i], sizeLeft); - if (length >= sizeLeft) - break; - - sizeLeft -= length; - udest += length; + team->args[0] = 0; + for (i = 1; i < argCount; i++) { + strlcat(team->args, " ", sizeof(team->args)); + strlcat(team->args, teamArgs->args[i], sizeof(team->args)); } free_team_arg(teamArgs);