From: Eric Bollengier Date: Fri, 18 Jun 2010 07:02:34 +0000 (+0200) Subject: Fix accurate code X-Git-Tag: Release-5.2.1~1288 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6b14b7f4f8d49437b48237c73f0979a72e5f0fed;p=bacula%2Fbacula Fix accurate code --- diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 8908fbae95..381f4c46aa 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -1129,9 +1129,18 @@ public: POOLMEM *list; /* list */ int count; /* number of values seen */ - db_list_ctx() { list = get_pool_memory(PM_FNAME); *list = 0; count = 0; } + db_list_ctx() { list = get_pool_memory(PM_FNAME); reset(); } ~db_list_ctx() { free_pool_memory(list); list = NULL; } - + void reset() { *list = 0; count = 0;} + void cat(const db_list_ctx &str) { + if (str.count > 0) { + if (*list) { + pm_strcat(list, ","); + } + pm_strcat(list, str.list); + count += str.count; + } + } private: db_list_ctx(const db_list_ctx&); /* prohibit pass by value */ db_list_ctx &operator=(const db_list_ctx&); /* prohibit class assignment */ diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 04f72849c3..7b9044b4ea 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1168,8 +1168,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, utime_t StartTime = (jr->StartTime)?jr->StartTime:time(NULL); bstrutime(date, sizeof(date), StartTime + 1); - jobids->list[0] = 0; - jobids->count = 0; + jobids->reset(); /* First, find the last good Full backup for this job/client/fileset */ Mmsg(query, create_temp_accurate_jobids[db_type],