Author: janderwald
Date: Thu Sep 6 01:00:32 2007
New Revision: 28884
URL:
http://svn.reactos.org/svn/reactos?rev=28884&view=rev
Log:
- delete pidfile if it exists before launching emulator
- delete pidfile on exit
- close pidfile on failure
Modified:
trunk/reactos/tools/sysreg/rosboot_test.cpp
Modified: trunk/reactos/tools/sysreg/rosboot_test.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/rosboot_test.…
==============================================================================
--- trunk/reactos/tools/sysreg/rosboot_test.cpp (original)
+++ trunk/reactos/tools/sysreg/rosboot_test.cpp Thu Sep 6 01:00:32 2007
@@ -578,22 +578,19 @@
return false;
}
}
+ 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();
if (!executeBootCmd())
{
cerr << "Error: failed to launch emulator with: " <<
m_BootCmd << endl;
return false;
}
-//#endif
return true;
}
@@ -647,6 +644,11 @@
}
delete m_DataSource;
m_DataSource = NULL;
+
+ if (m_PidFile.length ())
+ {
+ _tremove(m_PidFile.c_str ());
+ }
}
//---------------------------------------------------------------------------------------
@@ -720,6 +722,7 @@
if (!fread(buffer, 1, sizeof(buffer), file))
{
cerr << "Error: pid file w/o pid!!! " << endl;
+ fclose(file);
cleanup();
return false;
}