From beee70da41b7e5b045bad651ad925d6dadc9647c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 14 Oct 2004 17:47:49 +0000 Subject: [PATCH] Changed system() to use load_image() instead of the old _kern_create_team() syscall. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9357 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/unistd/system.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/kernel/libroot/posix/unistd/system.cpp b/src/kernel/libroot/posix/unistd/system.cpp index 0731013ec1..fd756851e2 100644 --- a/src/kernel/libroot/posix/unistd/system.cpp +++ b/src/kernel/libroot/posix/unistd/system.cpp @@ -3,15 +3,15 @@ ** Distributed under the terms of the Haiku License. */ -#include + +#include + #include +#include +#include -#include -#include - -extern "C" -int +extern "C" int system(const char *command) { if (!command) @@ -20,15 +20,14 @@ system(const char *command) const char *argv[] = { "/bin/sh", "-c", command, NULL }; int argc = 3; - team_id team = _kern_create_team(argv[0], argv[0], (char**)argv, argc, NULL, - 0, B_NORMAL_PRIORITY); - if (team < 0) { - errno = team; + thread_id thread = load_image(argc, argv, (const char **)environ); + if (thread < 0) { + errno = thread; return -1; } status_t returnValue; - status_t error = _kern_wait_for_team(team, &returnValue); + status_t error = wait_for_thread(thread, &returnValue); if (error != B_OK) { errno = error; return -1;