From 25ca8ce146cd469d42f77cd747f0b9f6f6fc11e0 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 20 Jun 2012 23:08:40 +0200 Subject: [PATCH] revert spawn funktion Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e6d4c049139193ad11425bf62d2ad202a086cc68 Author: Jacek Jendrzej Date: 2012-06-20 (Wed, 20 Jun 2012) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/plugins.cpp | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp index 629d1c97a..13ec9c526 100644 --- a/src/gui/plugins.cpp +++ b/src/gui/plugins.cpp @@ -40,7 +40,8 @@ #include #include -#include +#include +#include #include #include @@ -93,7 +94,7 @@ int CPlugins::find_plugin(const std::string & filename) bool CPlugins::pluginfile_exists(const std::string & filename) { struct stat stat_buf; - if(stat(filename.c_str(), &stat_buf) == 0) + if(::stat(filename.c_str(), &stat_buf) == 0) { return true; } else @@ -324,7 +325,6 @@ void CPlugins::startScriptPlugin(int number) script, plugin_list[number].cfgfile.c_str()); return; } -#if 0 FILE *f = popen(script,"r"); if (f != NULL) { @@ -343,39 +343,6 @@ void CPlugins::startScriptPlugin(int number) { printf("[CPlugins] can't execute %s\n",script); } -#else - int out[2], in[2]; - int pid,i; - const int buf_size=1024; - char* spawnedArgs[] = { (char *)"/bin/sh", (char *)0 }; - char buf[buf_size]; - memset(buf,0, buf_size); - posix_spawn_file_actions_t action; - - pipe(out); - pipe(in); - - posix_spawn_file_actions_init(&action); - posix_spawn_file_actions_adddup2(&action, out[0], 0); - posix_spawn_file_actions_addclose(&action, out[1]); - - posix_spawn_file_actions_adddup2(&action, in[1], 1); - posix_spawn_file_actions_addclose(&action, in[0]); - - posix_spawnp(&pid, spawnedArgs[0], &action, NULL, spawnedArgs, NULL); - - close(out[0]); - close(in[1]); - - write(out[1], plugin_list[number].pluginfile.c_str(), plugin_list[number].pluginfile.size()); - close(out[1]); - - - while ( (i = read(in[0], buf, buf_size)) != 0 ) { - scriptOutput += buf; - memset(buf,0, buf_size); - } -#endif } int mysystem(char * cmd, char * arg1, char * arg2);