mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +02:00
my_system fix
Origin commit data
------------------
Branch: ni/coolstream
Commit: 87342fd0d9
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2012-09-15 (Sat, 15 Sep 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1451,7 +1451,7 @@ bool CRecordManager::RunStartScript(void)
|
||||
return false;
|
||||
|
||||
puts("[neutrino.cpp] executing " NEUTRINO_RECORDING_START_SCRIPT ".");
|
||||
if (file_exists(NEUTRINO_RECORDING_START_SCRIPT) && my_system(NEUTRINO_RECORDING_START_SCRIPT,NULL,NULL) != 0) {
|
||||
if (my_system(NEUTRINO_RECORDING_START_SCRIPT) != 0) {
|
||||
perror(NEUTRINO_RECORDING_START_SCRIPT " failed");
|
||||
return false;
|
||||
}
|
||||
@@ -1465,7 +1465,7 @@ bool CRecordManager::RunStopScript(void)
|
||||
return false;
|
||||
|
||||
puts("[neutrino.cpp] executing " NEUTRINO_RECORDING_ENDED_SCRIPT ".");
|
||||
if (file_exists(NEUTRINO_RECORDING_ENDED_SCRIPT) && my_system(NEUTRINO_RECORDING_ENDED_SCRIPT,NULL,NULL) != 0) {
|
||||
if (my_system(NEUTRINO_RECORDING_ENDED_SCRIPT) != 0) {
|
||||
perror(NEUTRINO_RECORDING_ENDED_SCRIPT " failed");
|
||||
return false;
|
||||
}
|
||||
|
@@ -318,7 +318,7 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
g_Sectionsd->setPauseScanning(true);
|
||||
|
||||
puts("[audioplayer.cpp] executing " AUDIOPLAYER_START_SCRIPT ".");
|
||||
if (file_exists(AUDIOPLAYER_START_SCRIPT) && my_system(AUDIOPLAYER_START_SCRIPT,NULL,NULL) != 0)
|
||||
if (my_system(AUDIOPLAYER_START_SCRIPT) != 0)
|
||||
perror("Datei " AUDIOPLAYER_START_SCRIPT " fehlt.Bitte erstellen, wenn gebraucht.\nFile " AUDIOPLAYER_START_SCRIPT " not found. Please create if needed.\n");
|
||||
|
||||
show();
|
||||
@@ -330,7 +330,7 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
m_frameBuffer->paintBackground();
|
||||
|
||||
puts("[audioplayer.cpp] executing " AUDIOPLAYER_END_SCRIPT ".");
|
||||
if (file_exists(AUDIOPLAYER_END_SCRIPT) && my_system(AUDIOPLAYER_END_SCRIPT,NULL,NULL) != 0)
|
||||
if (my_system(AUDIOPLAYER_END_SCRIPT) != 0)
|
||||
perror("Datei " AUDIOPLAYER_END_SCRIPT " fehlt. Bitte erstellen, wenn gebraucht.\nFile " AUDIOPLAYER_END_SCRIPT " not found. Please create if needed.\n");
|
||||
|
||||
g_Zapit->unlockPlayBack();
|
||||
|
@@ -176,7 +176,7 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
|
||||
startposition = 0;
|
||||
|
||||
puts("[movieplayer.cpp] executing " MOVIEPLAYER_START_SCRIPT ".");
|
||||
if (file_exists(MOVIEPLAYER_START_SCRIPT) && my_system(MOVIEPLAYER_START_SCRIPT,NULL,NULL) != 0)
|
||||
if (my_system(MOVIEPLAYER_START_SCRIPT) != 0)
|
||||
perror(MOVIEPLAYER_START_SCRIPT " failed");
|
||||
|
||||
isMovieBrowser = false;
|
||||
@@ -214,7 +214,7 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
|
||||
bookmarkmanager->flush();
|
||||
|
||||
puts("[movieplayer.cpp] executing " MOVIEPLAYER_END_SCRIPT ".");
|
||||
if (file_exists(MOVIEPLAYER_END_SCRIPT) && my_system(MOVIEPLAYER_END_SCRIPT,NULL,NULL) != 0)
|
||||
if (my_system(MOVIEPLAYER_END_SCRIPT) != 0)
|
||||
perror(MOVIEPLAYER_END_SCRIPT " failed");
|
||||
|
||||
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
|
||||
|
@@ -249,7 +249,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey)
|
||||
|
||||
if(!manual) {
|
||||
g_RCInput->close_click();
|
||||
if (file_exists(NEUTRINO_SCAN_START_SCRIPT) && my_system(NEUTRINO_SCAN_START_SCRIPT,NULL,NULL) != 0)
|
||||
if (my_system(NEUTRINO_SCAN_START_SCRIPT) != 0)
|
||||
perror(NEUTRINO_SCAN_START_SCRIPT " failed");
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey)
|
||||
g_Zapit->stopScan();
|
||||
|
||||
if(!manual) {
|
||||
if (file_exists(NEUTRINO_SCAN_STOP_SCRIPT) && my_system(NEUTRINO_SCAN_STOP_SCRIPT,NULL,NULL) != 0)
|
||||
if (my_system(NEUTRINO_SCAN_STOP_SCRIPT) != 0)
|
||||
perror(NEUTRINO_SCAN_STOP_SCRIPT " failed");
|
||||
g_RCInput->open_click();
|
||||
}
|
||||
|
@@ -1737,7 +1737,7 @@ void wake_up( bool &wakeup)
|
||||
if(!wakeup){
|
||||
const char *neutrino_leave_deepstandby_script = CONFIGDIR "/deepstandby.off";
|
||||
printf("[%s] executing %s\n",__FILE__ ,neutrino_leave_deepstandby_script);
|
||||
if (file_exists(neutrino_leave_deepstandby_script) && my_system(neutrino_leave_deepstandby_script,NULL,NULL) != 0)
|
||||
if (my_system(neutrino_leave_deepstandby_script) != 0)
|
||||
perror( neutrino_leave_deepstandby_script );
|
||||
}
|
||||
#endif
|
||||
@@ -2677,8 +2677,8 @@ _repeat:
|
||||
return messages_return::handled;
|
||||
}
|
||||
else if( msg == NeutrinoMessages::ANNOUNCE_RECORD) {
|
||||
if(file_exists(NEUTRINO_RECORDING_TIMER_SCRIPT))
|
||||
my_system(NEUTRINO_RECORDING_TIMER_SCRIPT,NULL,NULL);
|
||||
my_system(NEUTRINO_RECORDING_TIMER_SCRIPT);
|
||||
|
||||
if (g_settings.recording_type == RECORDING_FILE) {
|
||||
char * recordingDir = ((CTimerd::RecordingInfo*)data)->recordingDir;
|
||||
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) {
|
||||
@@ -2938,14 +2938,14 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode)
|
||||
if(retcode) {
|
||||
const char *neutrino_enter_deepstandby_script = CONFIGDIR "/deepstandby.on";
|
||||
printf("[%s] executing %s\n",__FILE__ ,neutrino_enter_deepstandby_script);
|
||||
if (file_exists(neutrino_enter_deepstandby_script) && my_system(neutrino_enter_deepstandby_script,NULL,NULL) != 0)
|
||||
if (my_system(neutrino_enter_deepstandby_script) != 0)
|
||||
perror(neutrino_enter_deepstandby_script );
|
||||
|
||||
printf("entering off state\n");
|
||||
mode = mode_off;
|
||||
//CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_SHUTDOWN));
|
||||
|
||||
system("/etc/init.d/rcK");
|
||||
my_system("/etc/init.d/rcK");
|
||||
system("/bin/sync");
|
||||
system("/bin/umount -a");
|
||||
sleep(1);
|
||||
@@ -3217,7 +3217,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
|
||||
standby_channel_id = CZapit::getInstance()->GetCurrentChannelID();
|
||||
|
||||
puts("[neutrino.cpp] executing " NEUTRINO_ENTER_STANDBY_SCRIPT ".");
|
||||
if (file_exists(NEUTRINO_ENTER_STANDBY_SCRIPT) && my_system(NEUTRINO_ENTER_STANDBY_SCRIPT,NULL,NULL) != 0)
|
||||
if (my_system(NEUTRINO_ENTER_STANDBY_SCRIPT) != 0)
|
||||
perror(NEUTRINO_ENTER_STANDBY_SCRIPT " failed");
|
||||
|
||||
if(!CRecordManager::getInstance()->RecordingStatus())
|
||||
@@ -3261,7 +3261,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby )
|
||||
}
|
||||
|
||||
puts("[neutrino.cpp] executing " NEUTRINO_LEAVE_STANDBY_SCRIPT ".");
|
||||
if (file_exists(NEUTRINO_LEAVE_STANDBY_SCRIPT) && my_system(NEUTRINO_LEAVE_STANDBY_SCRIPT,NULL,NULL) != 0)
|
||||
if (my_system(NEUTRINO_LEAVE_STANDBY_SCRIPT) != 0)
|
||||
perror(NEUTRINO_LEAVE_STANDBY_SCRIPT " failed");
|
||||
|
||||
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
|
||||
|
@@ -58,10 +58,18 @@ void wakeup_hdd(const char *hdd_dir)
|
||||
sync();
|
||||
}
|
||||
}
|
||||
|
||||
int my_system(const char * cmd, const char * arg1, const char * arg2)
|
||||
//use for script with full path
|
||||
int my_system(const char * cmd)
|
||||
{
|
||||
int i;
|
||||
if (!file_exists(cmd))
|
||||
return -1;
|
||||
|
||||
return my_system(cmd, NULL);
|
||||
}
|
||||
|
||||
int my_system(const char * cmd, const char * arg1, const char * arg2, const char * arg3, const char * arg4, const char * arg5, const char * arg6)
|
||||
{
|
||||
int i=0 ,ret=0;
|
||||
pid_t pid;
|
||||
int maxfd = getdtablesize();// sysconf(_SC_OPEN_MAX);
|
||||
switch (pid = vfork())
|
||||
@@ -72,16 +80,18 @@ int my_system(const char * cmd, const char * arg1, const char * arg2)
|
||||
case 0: /* child process */
|
||||
for(i = 3; i < maxfd; i++)
|
||||
close(i);
|
||||
if(execlp(cmd, cmd, arg1, arg2, NULL))
|
||||
if(execlp(cmd, cmd, arg1, arg2, arg3, arg3, arg4, arg5, arg6, NULL))
|
||||
{
|
||||
perror("exec");
|
||||
std::string txt = "ERROR: my_system \"" + (std::string) cmd + "\"";
|
||||
perror(txt.c_str());
|
||||
}
|
||||
exit(0);
|
||||
ret = 1;
|
||||
_exit (0); // terminate c h i l d proces s only
|
||||
default: /* parent returns to calling process */
|
||||
break;
|
||||
}
|
||||
waitpid(pid, 0, 0);
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type)
|
||||
|
@@ -22,7 +22,10 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
int my_system(const char * cmd, const char * arg1, const char * arg2);
|
||||
int my_system(const char * cmd, const char * arg1, const char * arg2 = NULL, const char * arg3 = NULL, const char * arg4 = NULL, const char * arg5 = NULL, const char * arg6 = NULL);
|
||||
|
||||
int my_system(const char * cmd);
|
||||
|
||||
FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type);
|
||||
int safe_mkdir(char * path);
|
||||
int check_dir(const char * newdir);
|
||||
|
Reference in New Issue
Block a user