From: Kern Sibbald Date: Thu, 7 Oct 2004 16:23:26 +0000 (+0000) Subject: Fix editing bug with new code X-Git-Tag: Release-1.35.8~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c9adb24fafb0dad5d1bf9dc815074a8a17e445ce;p=bacula%2Fbacula Fix editing bug with new code - Fix bug where SD crashes on label if drive is not open (i.e. Always Open = no). git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1636 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/bdb_find.c b/bacula/src/cats/bdb_find.c index 4d43cdfa96..38e8a57c46 100644 --- a/bacula/src/cats/bdb_find.c +++ b/bacula/src/cats/bdb_find.c @@ -183,5 +183,9 @@ int db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr) { return 0; } +bool +db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int &JobLevel) +{ return false; } + #endif /* HAVE_BACULA_DB */ diff --git a/bacula/src/cats/sql.c b/bacula/src/cats/sql.c index 4566917da2..75b8e94333 100644 --- a/bacula/src/cats/sql.c +++ b/bacula/src/cats/sql.c @@ -305,6 +305,13 @@ void db_start_transaction(JCR *jcr, B_DB *mdb) void db_end_transaction(JCR *jcr, B_DB *mdb) { + /* + * This can be called during thread cleanup and + * the db may already be closed. So simply return. + */ + if (!mdb) { + return; + } #ifdef HAVE_SQLITE if (!mdb->allow_transactions) { return; diff --git a/bacula/src/cats/sql_find.c b/bacula/src/cats/sql_find.c index 436340d804..b09d69189d 100644 --- a/bacula/src/cats/sql_find.c +++ b/bacula/src/cats/sql_find.c @@ -159,11 +159,11 @@ db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int & db_lock(mdb); /* Differential is since last Full backup */ Mmsg(mdb->cmd, -"SELECT JobLevel FROM Job WHERE JobStatus!='T' AND Type='%c' AND " +"SELECT Level FROM Job WHERE JobStatus!='T' AND Type='%c' AND " "Level IN ('%c','%c') AND Name='%s' AND ClientId=%u " "AND FileSetId=%u AND StartTime>'%s' " "ORDER BY StartTime DESC LIMIT 1", - jr->JobType, L_INCREMENTAL, L_DIFFERENTIAL, jr->Name, + jr->JobType, L_FULL, L_DIFFERENTIAL, jr->Name, jr->ClientId, jr->FileSetId, stime); if (!QUERY_DB(jcr, mdb, mdb->cmd)) { @@ -176,7 +176,7 @@ db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int & db_unlock(mdb); return false; } - JobLevel = str_to_int64(row[0]); + JobLevel = (int)*row[0]; sql_free_result(mdb); db_unlock(mdb); diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 9f7d07c7a9..bba769df66 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -131,7 +131,6 @@ int do_backup(JCR *jcr) goto bail_out; } - /* * Open a message channel connection with the Storage * daemon. This is to let him know that our client