summaryrefslogtreecommitdiffstats
path: root/src/Daemon/Daemon.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-08-28 14:06:18 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-08-28 14:06:18 +0200
commit5b07fe7069347f4c442155cc737ef24bd85fa24a (patch)
tree1ffec21b4d38f942d816a062a016b365a0bdd51c /src/Daemon/Daemon.cpp
parent7cd21b9ed1a87af2979573b580508651466a67a8 (diff)
downloadabrt-5b07fe7069347f4c442155cc737ef24bd85fa24a.tar.gz
abrt-5b07fe7069347f4c442155cc737ef24bd85fa24a.tar.xz
abrt-5b07fe7069347f4c442155cc737ef24bd85fa24a.zip
daemon: log DBus calls with -v; log file creation only with -vvv
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon/Daemon.cpp')
-rw-r--r--src/Daemon/Daemon.cpp116
1 files changed, 57 insertions, 59 deletions
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index b6155f1..ea41302 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -451,75 +451,73 @@ static gboolean handle_event_cb(GIOChannel *gio, GIOCondition condition, gpointe
event = (struct inotify_event *) &buf[i];
if (event->len)
- name = &buf[i] + sizeof (struct inotify_event);
- i += sizeof (struct inotify_event) + event->len;
+ name = &buf[i] + sizeof (*event);
+ i += sizeof (*event) + event->len;
- log("Created file: %s", name);
+ /* ignore lock files and such */
+ if (!(event->mask & IN_ISDIR))
+ {
+ VERB3 log("File '%s' creation detected, ignoring", name);
+ continue;
+ }
- /* we ignore the lock files */
- if (event->mask & IN_ISDIR)
+ log("Directory '%s' creation detected", name);
+ if (GetDirSize(DEBUG_DUMPS_DIR) / (1024*1024) >= g_settings_nMaxCrashReportsSize)
+ {
+//TODO: delete oldest or biggest dir
+ log("Size of '%s' >= %u MB, deleting '%s'", DEBUG_DUMPS_DIR, g_settings_nMaxCrashReportsSize, name);
+ DeleteDebugDumpDir(std::string(DEBUG_DUMPS_DIR) + "/" + name);
+ continue;
+ }
+
+ map_crash_info_t crashinfo;
+ try
{
- if (GetDirSize(DEBUG_DUMPS_DIR) / (1024*1024) < g_settings_nMaxCrashReportsSize)
+ mw_result_t res;
+ res = SaveDebugDump(std::string(DEBUG_DUMPS_DIR) + "/" + name, crashinfo);
+ switch (res)
{
- //std::string sName = name;
- map_crash_info_t crashinfo;
- try
- {
- mw_result_t res;
- res = SaveDebugDump(std::string(DEBUG_DUMPS_DIR) + "/" + name, crashinfo);
- switch (res)
- {
- case MW_OK:
- log("New crash, saving...");
- RunActionsAndReporters(crashinfo[CD_MWDDD][CD_CONTENT]);
- /* Send dbus signal */
- g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT], crashinfo[CD_UID][CD_CONTENT]);
- break;
- case MW_REPORTED:
- case MW_OCCURED:
- log("Already saved crash, deleting...");
- /* Send dbus signal */
- g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT], crashinfo[CD_UID][CD_CONTENT]);
- DeleteDebugDumpDir(std::string(DEBUG_DUMPS_DIR) + "/" + name);
- break;
- case MW_BLACKLISTED:
- case MW_CORRUPTED:
- case MW_PACKAGE_ERROR:
- case MW_GPG_ERROR:
- case MW_IN_DB:
- case MW_FILE_ERROR:
- default:
- warn_client("Corrupted or bad crash, deleting...");
- DeleteDebugDumpDir(std::string(DEBUG_DUMPS_DIR) + "/" + name);
- break;
- }
- }
- catch (CABRTException& e)
- {
- warn_client(e.what());
- if (e.type() == EXCEP_FATAL)
- {
- delete[] buf;
- return -1;
- }
- }
- catch (...)
- {
- delete[] buf;
- throw;
- }
+ case MW_OK:
+ log("New crash, saving...");
+ RunActionsAndReporters(crashinfo[CD_MWDDD][CD_CONTENT]);
+ /* Send dbus signal */
+ g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT], crashinfo[CD_UID][CD_CONTENT]);
+ break;
+ case MW_REPORTED:
+ case MW_OCCURED:
+ log("Already saved crash, deleting...");
+ /* Send dbus signal */
+ g_pCommLayer->Crash(crashinfo[CD_PACKAGE][CD_CONTENT], crashinfo[CD_UID][CD_CONTENT]);
+ DeleteDebugDumpDir(std::string(DEBUG_DUMPS_DIR) + "/" + name);
+ break;
+ case MW_BLACKLISTED:
+ case MW_CORRUPTED:
+ case MW_PACKAGE_ERROR:
+ case MW_GPG_ERROR:
+ case MW_IN_DB:
+ case MW_FILE_ERROR:
+ default:
+ warn_client("Corrupted or bad crash, deleting...");
+ DeleteDebugDumpDir(std::string(DEBUG_DUMPS_DIR) + "/" + name);
+ break;
}
- else
+ }
+ catch (CABRTException& e)
+ {
+ warn_client(e.what());
+ if (e.type() == EXCEP_FATAL)
{
- log("DebugDumps size has exceeded the limit, deleting the last dump: %s", name);
- DeleteDebugDumpDir(std::string(DEBUG_DUMPS_DIR) + "/" + name);
+ delete[] buf;
+ return -1;
}
}
- else
+ catch (...)
{
- log("Some file created, ignoring...");
+ delete[] buf;
+ throw;
}
- }
+ } /* while */
+
delete[] buf;
return TRUE;
}