Skip to content
Snippets Groups Projects
Commit 8769d7ac authored by Andrea Zoli's avatar Andrea Zoli
Browse files

Throw exception on chdir error.

parent 9f053e53
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <unistd.h> #include <unistd.h>
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include <sstream>
using namespace PacketLib; using namespace PacketLib;
...@@ -54,7 +55,13 @@ bool ConfigurationFile::open(char** parameters) throw(PacketExceptionIO*) ...@@ -54,7 +55,13 @@ bool ConfigurationFile::open(char** parameters) throw(PacketExceptionIO*)
void ConfigurationFile::close() throw(PacketExceptionIO*) void ConfigurationFile::close() throw(PacketExceptionIO*)
{ {
InputTextFile::close(); InputTextFile::close();
chdir(currentpwd); int retval = chdir(currentpwd);
if(retval == -1)
{
std::stringstream ss;
ss << "Invalid chdir on '" << currentpwd << "'" << std::endl;
throw PacketExceptionIO(ss.str().c_str());
}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment