diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp index 6588bdd787..7b857b6465 100644 --- a/src/system/kernel/team.cpp +++ b/src/system/kernel/team.cpp @@ -1306,8 +1306,6 @@ exec_team(const char *path, int32 argCount, char * const *args, TRACE(("exec_team(path = \"%s\", argc = %ld, envCount = %ld): team %ld\n", args[0], argCount, envCount, team->id)); - T(ExecTeam(path, argCount, args, envCount, env)); - // switching the kernel at run time is probably not a good idea :) if (team == team_get_kernel_team()) return B_NOT_ALLOWED; @@ -1348,6 +1346,9 @@ exec_team(const char *path, int32 argCount, char * const *args, if (status != B_OK) return status; + T(ExecTeam(path, teamArgs->arg_count, teamArgs->args, envCount, env)); + // trace here, so we don't have to deal with the user addresses + // replace args[0] with the path argument, just to be on the safe side free(teamArgs->args[0]); teamArgs->args[0] = strdup(path);