helpers: improve my_system function

Instead of hardcoding the maximum number of arguments to the
my_system helper, pass a variable argument list.
The function is deliberately source-incompatible with the old
implementation (as opposed to a variant with a sentinel NULL
argument, which would be compatible) to find all users and to
make sure that new future users of this function are not
overlooked during merges with other branches.


Origin commit data
------------------
Commit: 96650cdd45
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-03-03 (Sun, 03 Mar 2013)
This commit is contained in:
Stefan Seyfried
2013-03-03 19:18:13 +01:00
parent 323852fc9b
commit 811e75380e
12 changed files with 51 additions and 31 deletions

View File

@@ -75,7 +75,7 @@ void CNetworkService::Start()
{
std::string cmd = command + " " + options;
printf("CNetworkService::Start: %s %s\n", command.c_str(), options.c_str());
my_system("/bin/sh", "-c", cmd.c_str());
my_system(3, "/bin/sh", "-c", cmd.c_str());
enabled = true;
TouchFile();
}
@@ -84,7 +84,7 @@ void CNetworkService::Stop()
{
const char killall []= "killall";
printf("CNetworkService::Stop: %s %s\n", killall, command.c_str());
my_system(killall, command.c_str());
my_system(2, killall, command.c_str());
enabled = false;
TouchFile();
}