From faf78b4e4d4657e3c896c579d8c2b1934f14eb32 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 6 Dec 2011 09:17:18 +0100 Subject: [PATCH] Fix #3419, update stats problem --- bacula/src/cats/sql_update.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index 22ff00a72a..27dd0ab411 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -135,12 +135,19 @@ int db_update_stats(JCR *jcr, B_DB *mdb, utime_t age) { char ed1[30]; + int rows; utime_t now = (utime_t)time(NULL); edit_uint64(now - age, ed1); + db_lock(mdb); + Mmsg(mdb->cmd, fill_jobhisto, ed1); QUERY_DB(jcr, mdb, mdb->cmd); /* TODO: get a message ? */ - return sql_affected_rows(mdb); + rows = sql_affected_rows(mdb); + + db_unlock(mdb); + + return rows; } /* -- 2.39.5