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
------------------
Branch: ni/coolstream
Commit: 96650cdd45
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-03-03 (Sun, 03 Mar 2013)



------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2013-03-03 19:18:13 +01:00
parent d576950a82
commit 4324865fb6
12 changed files with 51 additions and 31 deletions

View File

@@ -298,10 +298,10 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
if(hdparm_link){
//hdparm -M is not included in busybox hdparm!
my_system(hdparm, S_opt, opt);
my_system(3, hdparm, S_opt, opt);
}else{
snprintf(M_opt, sizeof(M_opt),"-M%d", g_settings.hdd_noise);
my_system(hdparm, M_opt, S_opt, opt);
my_system(4, hdparm, M_opt, S_opt, opt);
}
free(namelist[i]);
}
@@ -362,7 +362,7 @@ static int umount_all(const char *dev)
if (! access("/etc/mdev/mdev-mount.sh", X_OK)) {
sprintf(buffer, "MDEV=%s%d ACTION=remove /etc/mdev/mdev-mount.sh block", d, i);
printf("-> running '%s'\n", buffer);
my_system("/bin/sh", "-c", buffer);
my_system(3, "/bin/sh", "-c", buffer);
}
#endif
sprintf(buffer, "/dev/%s%d", d, i);
@@ -473,7 +473,7 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
if(res != CMessageBox::mbrYes)
return 0;
bool srun = my_system("killall", "-9", "smbd");
bool srun = my_system(3, "killall", "-9", "smbd");
//res = check_and_umount(dst);
//res = check_and_umount(src, dst);
@@ -622,7 +622,7 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
waitfordev(src, 30); /* mdev can somtimes takes long to create devices, especially after mkfs? */
printf("CHDDFmtExec: executing %s %s\n","/sbin/tune2fs -r 0 -c 0 -i 0", src);
my_system("/sbin/tune2fs", "-r 0", "-c 0", "-i 0", src);
my_system(5, "/sbin/tune2fs", "-r 0", "-c 0", "-i 0", src);
_remount:
unlink("/tmp/.nomdevmount");
@@ -711,7 +711,7 @@ _remount:
#endif
}
_return:
if(!srun) my_system("smbd",NULL);
if (!srun) my_system(1, "smbd");
return menu_return::RETURN_REPAINT;
}
@@ -731,7 +731,7 @@ int CHDDChkExec::exec(CMenuTarget* /*parent*/, const std::string& key)
printf("CHDDChkExec: key %s\n", key.c_str());
bool srun = my_system("killall", "-9", "smbd");
bool srun = my_system(3, "killall", "-9", "smbd");
//res = check_and_umount(dst);
//res = check_and_umount(src, dst);
@@ -820,6 +820,6 @@ ret1:
}
printf("CHDDChkExec: mount res %d\n", res);
if(!srun) my_system("smbd",NULL);
if (!srun) my_system(1, "smbd");
return menu_return::RETURN_REPAINT;
}