On 10/05/2010 05:33 PM, Denys Vlasenko wrote:
On Mon, 2010-10-04 at 12:05 +0200, Nikola Pajkovsky wrote:
transform vector_string_t to GList
Signed-off-by: Nikola Pajkovskynpajkovs@redhat.com
src/daemon/Daemon.cpp | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/daemon/Daemon.cpp b/src/daemon/Daemon.cpp index f54acde..1ea83a4 100644 --- a/src/daemon/Daemon.cpp +++ b/src/daemon/Daemon.cpp @@ -386,7 +386,7 @@ static int SetUpCron() static void FindNewDumps(const char* pPath) { /* Get all debugdump directories in the pPath directory */
- vector_string_t dirs;
- GList *dirs = NULL; DIR *dp = opendir(pPath); if (dp == NULL) {
@@ -405,25 +405,23 @@ static void FindNewDumps(const char* pPath) if (S_ISDIR(stats.st_mode)) { VERB1 log("Will check directory '%s'", ep->d_name);
dirs.push_back(dname);
dirs = g_list_append(dirs, dname); } }
free(dname); }
If S_ISDIR(stats.st_mode) check is not true, "dname" is not added to the list, and needs to be freed.
Good catch. I've modified to
if (lstat(dname, &stats) == 0) { if (S_ISDIR(stats.st_mode)) { .... continue; } } free(dname);
- vector_string_t::iterator itt = dirs.begin();
- for (; itt != dirs.end(); ++itt)
- for (GList *li = dirs; li != NULL; li = g_list_next(li)) { try {
const char *dir_name = itt->c_str();
const char *dir_name = (char*)dirs->data; map_crash_data_t crashinfo; mw_result_t res = SaveDebugDump(dir_name, crashinfo); switch (res)
@@ -456,6 +454,12 @@ static void FindNewDumps(const char* pPath) error_msg("%s", e.what()); } }
- for (GList *li = dirs; li != NULL; li = g_list_next(li))
free((char*)li->data);
li->data is void*, cast should not be needed.
also fixed
Apart from this, patch looks good and can be applied to git. Thanks!
Thank you.