summaryrefslogtreecommitdiffstats
path: root/src/Daemon/CrashWatcher.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-04 19:09:50 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-04 19:09:50 +0200
commit15c6d7ffee04ce477c8e71392f7c71482daabfce (patch)
tree533c3c3ad67b320c60e7595aa6a74619a96f9966 /src/Daemon/CrashWatcher.cpp
parent26904c7faff196b91c1ad50574f725cd1a033094 (diff)
downloadabrt-15c6d7ffee04ce477c8e71392f7c71482daabfce.tar.gz
abrt-15c6d7ffee04ce477c8e71392f7c71482daabfce.tar.xz
abrt-15c6d7ffee04ce477c8e71392f7c71482daabfce.zip
made some functions static
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon/CrashWatcher.cpp')
-rw-r--r--src/Daemon/CrashWatcher.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp
index 3163d851..1dc99dfa 100644
--- a/src/Daemon/CrashWatcher.cpp
+++ b/src/Daemon/CrashWatcher.cpp
@@ -42,6 +42,7 @@ to_string( T x )
*/
/* Is it "." or ".."? */
+/* abrtlib candidate */
static bool dot_or_dotdot(const char *filename)
{
if (filename[0] != '.') return false;
@@ -51,6 +52,8 @@ static bool dot_or_dotdot(const char *filename)
return false;
}
+static double GetDirSize(const std::string &pPath);
+
gboolean CCrashWatcher::handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointer daemon)
{
GIOError err;
@@ -81,7 +84,8 @@ gboolean CCrashWatcher::handle_event_cb(GIOChannel *gio, GIOCondition condition,
/* we want to ignore the lock files */
if (event->mask & IN_ISDIR)
{
- if (cc->GetDirSize(DEBUG_DUMPS_DIR)/(1024*1024.0) < cc->m_pSettings->GetMaxCrashReportsSize()){
+ if (GetDirSize(DEBUG_DUMPS_DIR) / (1024*1024) < cc->m_pSettings->GetMaxCrashReportsSize())
+ {
//std::string sName = name;
map_crash_info_t crashinfo;
try
@@ -402,13 +406,13 @@ void CCrashWatcher::Debug(const std::string& pMessage, const std::string& pDest)
std::cout << "Debug: " + pMessage << std::endl;
}
-double CCrashWatcher::GetDirSize(const std::string &pPath)
+static double GetDirSize(const std::string &pPath)
{
double size = 0;
struct dirent *ep;
struct stat stats;
DIR *dp;
- std::string dname;
+
dp = opendir(pPath.c_str());
if (dp != NULL)
{
@@ -416,7 +420,7 @@ double CCrashWatcher::GetDirSize(const std::string &pPath)
{
if (dot_or_dotdot(ep->d_name))
continue;
- dname = pPath + "/" + ep->d_name;
+ std::string dname = pPath + "/" + ep->d_name;
if (lstat(dname.c_str(), &stats) == 0)
{
if (S_ISDIR(stats.st_mode))
@@ -429,11 +433,11 @@ double CCrashWatcher::GetDirSize(const std::string &pPath)
}
}
}
- (void) closedir(dp);
+ closedir(dp);
}
else
{
- throw CABRTException(EXCEP_FATAL, "CCrashWatcher::GetDirSize(): Init Failed");
+ throw CABRTException(EXCEP_FATAL, std::string(__func__) + ": Init Failed");
}
return size;
}