- delete pidfile if it exists before launching emulator

- delete pidfile on exit
- close pidfile on failure

svn path=/trunk/; revision=28884
This commit is contained in:
Johannes Anderwald 2007-09-05 21:00:32 +00:00
parent fe82da5539
commit 1c8e960090

View file

@ -578,22 +578,19 @@ namespace Sysreg_
return false; return false;
} }
} }
cerr << "Opening Data Source:" << m_BootCmd << endl; if (m_PidFile.length () && isFileExisting(m_PidFile))
{
cerr << "Deleting pid file " << m_PidFile << endl;
_tremove(m_PidFile.c_str ());
}
/* cerr << "Opening Data Source:" << m_BootCmd << endl;
#ifdef __LINUX__
_tremove(m_PidFile.c_str ());
m_DataSource = new PipeReader();
m_Src = m_BootCmd;
#else
*/
m_DataSource = new NamedPipeReader(); m_DataSource = new NamedPipeReader();
if (!executeBootCmd()) if (!executeBootCmd())
{ {
cerr << "Error: failed to launch emulator with: " << m_BootCmd << endl; cerr << "Error: failed to launch emulator with: " << m_BootCmd << endl;
return false; return false;
} }
//#endif
return true; return true;
} }
@ -647,6 +644,11 @@ namespace Sysreg_
} }
delete m_DataSource; delete m_DataSource;
m_DataSource = NULL; m_DataSource = NULL;
if (m_PidFile.length ())
{
_tremove(m_PidFile.c_str ());
}
} }
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
@ -720,6 +722,7 @@ namespace Sysreg_
if (!fread(buffer, 1, sizeof(buffer), file)) if (!fread(buffer, 1, sizeof(buffer), file))
{ {
cerr << "Error: pid file w/o pid!!! " << endl; cerr << "Error: pid file w/o pid!!! " << endl;
fclose(file);
cleanup(); cleanup();
return false; return false;
} }