mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-01 09:51:13 +02:00
use my_system instead of system
Origin commit data
------------------
Commit: bb2efeb45b
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2012-10-02 (Tue, 02 Oct 2012)
This commit is contained in:
@@ -269,21 +269,34 @@ int CHDDMenuHandler::doMenu ()
|
||||
|
||||
int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
|
||||
{
|
||||
char cmd[100];
|
||||
char M_opt[50],S_opt[50];
|
||||
char opt[100];
|
||||
struct dirent **namelist;
|
||||
int n = scandir("/sys/block", &namelist, my_filter, alphasort);
|
||||
|
||||
if (n < 0)
|
||||
return 0;
|
||||
|
||||
const char hdparm[] = "/sbin/hdparm";
|
||||
bool hdparm_link = false;
|
||||
struct stat stat_buf;
|
||||
if(::lstat(hdparm, &stat_buf) == 0)
|
||||
if( S_ISLNK(stat_buf.st_mode) )
|
||||
hdparm_link = true;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
printf("CHDDDestExec: noise %d sleep %d /dev/%s\n",
|
||||
g_settings.hdd_noise, g_settings.hdd_sleep, namelist[i]->d_name);
|
||||
//hdparm -M is not included in busybox hdparm!
|
||||
//we need full version of hdparm or should remove -M parameter here
|
||||
snprintf(cmd, sizeof(cmd), "hdparm -M%d -S%d /dev/%s >/dev/null 2>/dev/null &",
|
||||
g_settings.hdd_noise, g_settings.hdd_sleep, namelist[i]->d_name);
|
||||
system(cmd);
|
||||
snprintf(S_opt, sizeof(S_opt),"-S%d", g_settings.hdd_sleep);
|
||||
snprintf(opt, sizeof(opt),"/dev/%s",namelist[i]->d_name);
|
||||
|
||||
if(hdparm_link){
|
||||
//hdparm -M is not included in busybox hdparm!
|
||||
my_system(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);
|
||||
}
|
||||
free(namelist[i]);
|
||||
}
|
||||
free(namelist);
|
||||
@@ -327,7 +340,7 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
|
||||
if(res != CMessageBox::mbrYes)
|
||||
return 0;
|
||||
|
||||
bool srun = system("killall -9 smbd");
|
||||
bool srun = my_system("killall", "-9", "smbd");
|
||||
|
||||
//res = check_and_umount(dst);
|
||||
res = check_and_umount(src, dst);
|
||||
@@ -462,9 +475,8 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
|
||||
progress->showGlobalStatus(100);
|
||||
sleep(2);
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "/sbin/tune2fs -r 0 -c 0 -i 0 %s", src);
|
||||
printf("CHDDFmtExec: executing %s\n", cmd);
|
||||
system(cmd);
|
||||
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);
|
||||
|
||||
_remount:
|
||||
progress->hide();
|
||||
@@ -498,7 +510,7 @@ _remount:
|
||||
sync();
|
||||
}
|
||||
_return:
|
||||
if(!srun) system("smbd");
|
||||
if(!srun) my_system("smbd",NULL);
|
||||
return menu_return::RETURN_REPAINT;
|
||||
}
|
||||
|
||||
@@ -518,7 +530,7 @@ int CHDDChkExec::exec(CMenuTarget* /*parent*/, const std::string& key)
|
||||
|
||||
printf("CHDDChkExec: key %s\n", key.c_str());
|
||||
|
||||
bool srun = system("killall -9 smbd");
|
||||
bool srun = my_system("killall", "-9", "smbd");
|
||||
|
||||
//res = check_and_umount(dst);
|
||||
res = check_and_umount(src, dst);
|
||||
@@ -602,6 +614,6 @@ ret1:
|
||||
}
|
||||
printf("CHDDChkExec: mount res %d\n", res);
|
||||
|
||||
if(!srun) system("smbd");
|
||||
if(!srun) my_system("smbd",NULL);
|
||||
return menu_return::RETURN_REPAINT;
|
||||
}
|
||||
|
Reference in New Issue
Block a user