Seems and work ok, you can push it.
Jirka
On 09/24/2010 05:44 PM, Nikola Pajkovsky wrote:
Signed-off-by: Nikola Pajkovsky<npajkovs(a)redhat.com>
---
src/daemon/Daemon.cpp | 8 ++++----
src/daemon/Settings.cpp | 6 ++++--
src/daemon/Settings.h | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/daemon/Daemon.cpp b/src/daemon/Daemon.cpp
index 4cecae1..6dd26ea 100644
--- a/src/daemon/Daemon.cpp
+++ b/src/daemon/Daemon.cpp
@@ -593,7 +593,7 @@ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition
condition, gpoin
if (ext&& strcmp(ext + 1, "working") == 0)
continue;
- const char *dir = g_settings_sWatchCrashdumpArchiveDir.c_str();
+ const char *dir = g_settings_sWatchCrashdumpArchiveDir;
log("Detected creation of file '%s' in upload directory
'%s'", name, dir);
if (fork() == 0)
{
@@ -994,11 +994,11 @@ int main(int argc, char** argv)
/* Watching DEBUG_DUMPS_DIR for new files... */
if (inotify_add_watch(inotify_fd, DEBUG_DUMPS_DIR, IN_CREATE | IN_MOVED_TO)<
0)
perror_msg_and_die("inotify_add_watch failed on '%s'",
DEBUG_DUMPS_DIR);
- if (!g_settings_sWatchCrashdumpArchiveDir.empty())
+ if (g_settings_sWatchCrashdumpArchiveDir)
{
- s_upload_watch = inotify_add_watch(inotify_fd,
g_settings_sWatchCrashdumpArchiveDir.c_str(), IN_CLOSE_WRITE|IN_MOVED_TO);
+ s_upload_watch = inotify_add_watch(inotify_fd,
g_settings_sWatchCrashdumpArchiveDir, IN_CLOSE_WRITE|IN_MOVED_TO);
if (s_upload_watch< 0)
- perror_msg_and_die("inotify_add_watch failed on '%s'",
g_settings_sWatchCrashdumpArchiveDir.c_str());
+ perror_msg_and_die("inotify_add_watch failed on '%s'",
g_settings_sWatchCrashdumpArchiveDir);
}
VERB1 log("Adding inotify watch to glib main loop");
channel_inotify = g_io_channel_unix_new(inotify_fd);
diff --git a/src/daemon/Settings.cpp b/src/daemon/Settings.cpp
index e0d13ef..f7b7d2e 100644
--- a/src/daemon/Settings.cpp
+++ b/src/daemon/Settings.cpp
@@ -54,8 +54,8 @@ bool g_settings_bOpenGPGCheck = false;
GList *g_settings_setOpenGPGPublicKeys = NULL;
GList *g_settings_setBlackListedPkgs = NULL;
GList *g_settings_setBlackListedPaths = NULL;
-std::string g_settings_sWatchCrashdumpArchiveDir;
char *g_settings_sDatabase = NULL;
+char *g_settings_sWatchCrashdumpArchiveDir = NULL;
unsigned int g_settings_nMaxCrashReportsSize = 1000;
bool g_settings_bProcessUnpackaged = false;
@@ -223,7 +223,7 @@ static int ParseCommon()
it = s_mapSectionCommon.find("WatchCrashdumpArchiveDir");
if (it != end)
{
- g_settings_sWatchCrashdumpArchiveDir = it->second;
+ g_settings_sWatchCrashdumpArchiveDir = xstrdup(it->second.c_str());
}
it = s_mapSectionCommon.find("MaxCrashReportsSize");
if (it != end)
@@ -583,4 +583,6 @@ void settings_free()
g_list_free(g_settings_setBlackListedPaths);
free(g_settings_sDatabase);
+
+ free(g_settings_sWatchCrashdumpArchiveDir);
}
diff --git a/src/daemon/Settings.h b/src/daemon/Settings.h
index e7151d7..5ee365f 100644
--- a/src/daemon/Settings.h
+++ b/src/daemon/Settings.h
@@ -32,8 +32,8 @@ extern GList *g_settings_setBlackListedPaths;
extern unsigned int g_settings_nMaxCrashReportsSize;
extern bool g_settings_bOpenGPGCheck;
extern bool g_settings_bProcessUnpackaged;
-extern std::string g_settings_sWatchCrashdumpArchiveDir;
extern char *g_settings_sDatabase;
+extern char *g_settings_sWatchCrashdumpArchiveDir;
extern map_cron_t g_settings_mapCron;
extern vector_pair_string_string_t g_settings_vectorActionsAndReporters;
extern map_analyzer_actions_and_reporters_t g_settings_mapAnalyzerActionsAndReporters;