[rhmessaging-commits] rhmessaging commits: r4009 - store/trunk/cpp/lib/jrnl.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Fri Jun 4 14:43:28 EDT 2010
Author: kpvdr
Date: 2010-06-04 14:43:28 -0400 (Fri, 04 Jun 2010)
New Revision: 4009
Modified:
store/trunk/cpp/lib/jrnl/jdir.cpp
Log:
Further tidy-up: closing directory handles in exception paths
Modified: store/trunk/cpp/lib/jrnl/jdir.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jdir.cpp 2010-06-04 17:37:23 UTC (rev 4008)
+++ store/trunk/cpp/lib/jrnl/jdir.cpp 2010-06-04 18:43:28 UTC (rev 4009)
@@ -152,6 +152,7 @@
newname << bak_dir << "/" << entry->d_name;
if (::rename(oldname.str().c_str(), newname.str().c_str()))
{
+ ::closedir(dir);
std::ostringstream oss;
oss << "file=\"" << oldname.str() << "\" dest=\"" <<
newname.str() << "\"" << FORMAT_SYSERR(errno);
@@ -195,6 +196,7 @@
newname << bak_dir_name << "/" << target_dir;
if (::rename(oldname.str().c_str(), newname.str().c_str()))
{
+ ::closedir(dir);
std::ostringstream oss;
oss << "file=\"" << oldname.str() << "\" dest=\"" << newname.str() << "\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_FMOVE, oss.str(), "jdir", "push_down");
@@ -284,6 +286,7 @@
std::string full_name(dirname + "/" + entry->d_name);
if (::stat(full_name.c_str(), &s))
{
+ ::closedir(dir);
std::ostringstream oss;
oss << "stat: file=\"" << full_name << "\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_STAT, oss.str(), "jdir", "delete_dir");
@@ -294,6 +297,7 @@
{
if(::unlink(full_name.c_str()))
{
+ ::closedir(dir);
std::ostringstream oss;
oss << "unlink: file=\"" << entry->d_name << "\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_UNLINK, oss.str(), "jdir", "delete_dir");
@@ -305,6 +309,7 @@
}
else // all other types, throw up!
{
+ ::closedir(dir);
std::ostringstream oss;
oss << "file=\"" << entry->d_name << "\" is not a dir, file or slink.";
oss << " (mode=0x" << std::hex << s.st_mode << std::dec << ")";
More information about the rhmessaging-commits
mailing list