From 6bea55baeae2dd5f9281cf1a38452991b7741dfd Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 27 Sep 2007 15:10:51 +0000 Subject: [PATCH] kes Fix FD->SD authorization failure, which was due to spurious wakeups from a pthread_cond_timedwait(). Simply check the predicate before continuing. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5671 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/cats/cats.h | 36 +++++++++++++-------------- bacula/src/cats/mysql.c | 48 +++++++++++++++--------------------- bacula/src/cats/postgresql.c | 28 ++++++++++++--------- bacula/src/cats/sql_create.c | 3 +-- bacula/src/cats/sqlite.c | 21 +++++++++------- bacula/src/filed/status.c | 2 +- bacula/src/lib/breg.c | 10 ++++---- bacula/src/lib/breg.h | 20 +++++++-------- bacula/src/lib/bsnprintf.c | 4 +-- bacula/src/lib/edit.c | 2 +- bacula/src/lib/jcr.c | 42 ++++++++++++++++++++++--------- bacula/src/lib/message.c | 2 +- bacula/src/lib/parse_conf.h | 2 +- bacula/src/lib/res.c | 2 +- bacula/src/stored/dev.c | 4 +-- bacula/src/stored/job.c | 4 +-- bacula/src/tools/testfind.c | 4 +-- bacula/src/version.h | 6 ++--- bacula/technotes-2.3 | 3 +++ 19 files changed, 132 insertions(+), 111 deletions(-) diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 1971b8681a..03e7f6adf1 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -187,10 +187,10 @@ SQL_ROW my_sqlite_fetch_row(B_DB *mdb); int my_sqlite_query(B_DB *mdb, const char *cmd); void my_sqlite_field_seek(B_DB *mdb, int field); SQL_FIELD *my_sqlite_fetch_field(B_DB *mdb); -extern char* my_sqlite_batch_lock_query; -extern char* my_sqlite_batch_unlock_query; -extern char* my_sqlite_batch_fill_filename_query; -extern char* my_sqlite_batch_fill_path_query; +extern const char* my_sqlite_batch_lock_query; +extern const char* my_sqlite_batch_unlock_query; +extern const char* my_sqlite_batch_fill_filename_query; +extern const char* my_sqlite_batch_fill_path_query; #else @@ -317,10 +317,10 @@ SQL_ROW my_sqlite_fetch_row(B_DB *mdb); int my_sqlite_query(B_DB *mdb, const char *cmd); void my_sqlite_field_seek(B_DB *mdb, int field); SQL_FIELD *my_sqlite_fetch_field(B_DB *mdb); -extern char* my_sqlite_batch_lock_query; -extern char* my_sqlite_batch_unlock_query; -extern char* my_sqlite_batch_fill_filename_query; -extern char* my_sqlite_batch_fill_path_query; +extern const char* my_sqlite_batch_lock_query; +extern const char* my_sqlite_batch_unlock_query; +extern const char* my_sqlite_batch_fill_filename_query; +extern const char* my_sqlite_batch_fill_path_query; #else @@ -398,11 +398,11 @@ struct B_DB { #define sql_batch_fill_path_query my_mysql_batch_fill_path_query -extern char* my_mysql_batch_lock_path_query; -extern char* my_mysql_batch_lock_filename_query; -extern char* my_mysql_batch_unlock_tables_query; -extern char* my_mysql_batch_fill_filename_query; -extern char* my_mysql_batch_fill_path_query; +extern const char* my_mysql_batch_lock_path_query; +extern const char* my_mysql_batch_lock_filename_query; +extern const char* my_mysql_batch_unlock_tables_query; +extern const char* my_mysql_batch_fill_filename_query; +extern constchar* my_mysql_batch_fill_path_query; extern void my_mysql_free_result(B_DB *mdb); #else @@ -486,11 +486,11 @@ typedef struct ATTR_DBR ATTR_DBR; int my_postgresql_batch_insert(JCR *jcr, B_DB *mdb, ATTR_DBR *ar); char *my_postgresql_copy_escape(char *dest, char *src, size_t len); -extern char* my_pg_batch_lock_path_query; -extern char* my_pg_batch_lock_filename_query; -extern char* my_pg_batch_unlock_tables_query; -extern char* my_pg_batch_fill_filename_query; -extern char* my_pg_batch_fill_path_query; +extern const char* my_pg_batch_lock_path_query; +extern const char* my_pg_batch_lock_filename_query; +extern const char* my_pg_batch_unlock_tables_query; +extern const char* my_pg_batch_fill_filename_query; +extern const char* my_pg_batch_fill_path_query; /* "Generic" names for easier conversion */ #define sql_store_result(x) ((x)->result) diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index cc5aee701b..e54db4cebc 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -351,34 +351,26 @@ void my_mysql_free_result(B_DB *mdb) } #ifdef HAVE_BATCH_FILE_INSERT -char *my_mysql_batch_lock_path_query = "LOCK TABLES Path write," - "batch write," - "Path as p write"; - - -char *my_mysql_batch_lock_filename_query = "LOCK TABLES Filename write," - "batch write," - "Filename as f write"; - -char *my_mysql_batch_unlock_tables_query = "UNLOCK TABLES"; - -char *my_mysql_batch_fill_path_query = "INSERT INTO Path (Path) " - "SELECT a.Path FROM " - "(SELECT DISTINCT Path " - "FROM batch) AS a " - "WHERE NOT EXISTS " - "(SELECT Path " - "FROM Path AS p " - "WHERE p.Path = a.Path)"; - -char *my_mysql_batch_fill_filename_query = "INSERT INTO Filename (Name) " - "SELECT a.Name FROM " - "(SELECT DISTINCT Name " - "FROM batch) AS a " - "WHERE NOT EXISTS " - "(SELECT Name " - "FROM Filename AS f " - "WHERE f.Name = a.Name)"; +const char *my_mysql_batch_lock_path_query = + "LOCK TABLES Path write, batch write, Path as p write"; + + +const char *my_mysql_batch_lock_filename_query = + "LOCK TABLES Filename write, batch write, Filename as f write"; + +const char *my_mysql_batch_unlock_tables_query = "UNLOCK TABLES"; + +const char *my_mysql_batch_fill_path_query = + "INSERT INTO Path (Path) " + "SELECT a.Path FROM " + "(SELECT DISTINCT Path FROM batch) AS a WHERE NOT EXISTS " + "(SELECT Path FROM Path AS p WHERE p.Path = a.Path)"; + +const char *my_mysql_batch_fill_filename_query = + "INSERT INTO Filename (Name) " + "SELECT a.Name FROM " + "(SELECT DISTINCT Name FROM batch) AS a WHERE NOT EXISTS " + "(SELECT Name FROM Filename AS f WHERE f.Name = a.Name)"; #endif /* HAVE_BATCH_FILE_INSERT */ #endif /* HAVE_MYSQL */ diff --git a/bacula/src/cats/postgresql.c b/bacula/src/cats/postgresql.c index dc0467041d..5f3d5bcb88 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -800,24 +800,28 @@ char *my_postgresql_copy_escape(char *dest, char *src, size_t len) } #ifdef HAVE_BATCH_FILE_INSERT -char *my_pg_batch_lock_path_query = "BEGIN; LOCK TABLE Path IN SHARE ROW EXCLUSIVE MODE"; +const char *my_pg_batch_lock_path_query = + "BEGIN; LOCK TABLE Path IN SHARE ROW EXCLUSIVE MODE"; -char *my_pg_batch_lock_filename_query = "BEGIN; LOCK TABLE Filename IN SHARE ROW EXCLUSIVE MODE"; +const char *my_pg_batch_lock_filename_query = + "BEGIN; LOCK TABLE Filename IN SHARE ROW EXCLUSIVE MODE"; -char *my_pg_batch_unlock_tables_query = "COMMIT"; +const char *my_pg_batch_unlock_tables_query = "COMMIT"; -char *my_pg_batch_fill_path_query = "INSERT INTO Path (Path) " - "SELECT a.Path FROM " - "(SELECT DISTINCT Path FROM batch) AS a " - "WHERE NOT EXISTS (SELECT Path FROM Path WHERE Path = a.Path) "; +const char *my_pg_batch_fill_path_query = + "INSERT INTO Path (Path) " + "SELECT a.Path FROM " + "(SELECT DISTINCT Path FROM batch) AS a " + "WHERE NOT EXISTS (SELECT Path FROM Path WHERE Path = a.Path) "; -char *my_pg_batch_fill_filename_query = "INSERT INTO Filename (Name) " - "SELECT a.Name FROM " - "(SELECT DISTINCT Name FROM batch) as a " - "WHERE NOT EXISTS " - "(SELECT Name FROM Filename WHERE Name = a.Name)"; +const char *my_pg_batch_fill_filename_query = + "INSERT INTO Filename (Name) " + "SELECT a.Name FROM " + "(SELECT DISTINCT Name FROM batch) as a " + "WHERE NOT EXISTS " + "(SELECT Name FROM Filename WHERE Name = a.Name)"; #endif /* HAVE_BATCH_FILE_INSERT */ #endif /* HAVE_POSTGRESQL */ diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 5c9c11fa5a..8ea820b36a 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -710,7 +710,7 @@ bool my_batch_start(JCR *jcr, B_DB *mdb) bool my_batch_insert(JCR *jcr, B_DB *mdb, ATTR_DBR *ar) { size_t len; - char *digest; + const char *digest; char ed1[50]; mdb->esc_name = check_pool_memory_size(mdb->esc_name, mdb->fnl*2+1); @@ -833,7 +833,6 @@ bool db_write_batch_file_records(JCR *jcr) */ bool db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar) { - int retry = 0; Dmsg1(dbglevel, "Fname=%s\n", ar->fname); Dmsg0(dbglevel, "put_file_into_catalog\n"); diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index 9459f3b8b5..964c30d9c1 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -456,15 +456,18 @@ SQL_FIELD *my_sqlite_fetch_field(B_DB *mdb) } #ifdef HAVE_BATCH_FILE_INSERT -char *my_sqlite_batch_lock_query = "BEGIN"; -char *my_sqlite_batch_unlock_query = "COMMIT"; -char *my_sqlite_batch_fill_path_query = "INSERT INTO Path (Path) " - " SELECT DISTINCT Path FROM batch " - " EXCEPT SELECT Path FROM Path "; - -char *my_sqlite_batch_fill_filename_query = "INSERT INTO Filename (Name) " - " SELECT DISTINCT Name FROM batch " - " EXCEPT SELECT Name FROM Filename "; +const char *my_sqlite_batch_lock_query = "BEGIN"; +const char *my_sqlite_batch_unlock_query = "COMMIT"; + +const char *my_sqlite_batch_fill_path_query = + "INSERT INTO Path (Path)" + " SELECT DISTINCT Path FROM batch" + " EXCEPT SELECT Path FROM Path"; + +const char *my_sqlite_batch_fill_filename_query = + "INSERT INTO Filename (Name)" + " SELECT DISTINCT Name FROM batch " + " EXCEPT SELECT Name FROM Filename"; #endif /* HAVE_BATCH_FILE_INSERT */ diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index c3c2da632d..afff50db84 100644 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -143,7 +143,7 @@ void output_status(void sendit(const char *msg, int len, void *sarg), void *arg) Dmsg0(1000, "Begin status jcr loop.\n"); len = Mmsg(msg, _("\nRunning Jobs:\n")); sendit(msg.c_str(), len, arg); - char *vss = ""; + const char *vss = ""; #ifdef WIN32_VSS if (g_pVSSClient && g_pVSSClient->IsInitialized()) { vss = "VSS "; diff --git a/bacula/src/lib/breg.c b/bacula/src/lib/breg.c index 0f742d6665..6a3d33c7ae 100644 --- a/bacula/src/lib/breg.c +++ b/bacula/src/lib/breg.c @@ -340,7 +340,7 @@ char *BREGEXP::edit_subst(const char *fname, regmatch_t regs[]) /* escape sep char and \ * dest must be long enough (src*2+1) * return end of the string */ -char *bregexp_escape_string(char *dest, char *src, char sep) +char *bregexp_escape_string(char *dest, const char *src, const char sep) { char *ret = dest; while (*src) @@ -357,10 +357,10 @@ char *bregexp_escape_string(char *dest, char *src, char sep) return ret; } -static char regexp_sep = '!'; -static char *str_strip_prefix = "!%s!!i"; -static char *str_add_prefix = "!^!%s!"; -static char *str_add_suffix = "!([^/])$!$1%s!"; +static const char regexp_sep = '!'; +static const char *str_strip_prefix = "!%s!!i"; +static const char *str_add_prefix = "!^!%s!"; +static const char *str_add_suffix = "!([^/])$!$1%s!"; int bregexp_get_build_where_size(char *strip_prefix, char *add_prefix, diff --git a/bacula/src/lib/breg.h b/bacula/src/lib/breg.h index 33be5397d1..27ddfbbd1f 100644 --- a/bacula/src/lib/breg.h +++ b/bacula/src/lib/breg.h @@ -61,18 +61,18 @@ */ class BREGEXP { public: - POOLMEM *result; /* match result */ - bool success; /* match is ok */ + POOLMEM *result; /* match result */ + bool success; /* match is ok */ char *replace(const char *fname); /* return this.result */ void debug(); /* private */ - POOLMEM *expr; /* search epression */ - POOLMEM *subst; /* substitution */ - regex_t preg; /* regex_t result of regcomp() */ + POOLMEM *expr; /* search epression */ + POOLMEM *subst; /* substitution */ + regex_t preg; /* regex_t result of regcomp() */ regmatch_t regs[BREG_NREGS]; /* contains match */ - char *eor; /* end of regexp in expr */ + char *eor; /* end of regexp in expr */ char *return_fname(const char *fname, int len); /* return fname as result */ char *edit_subst(const char *fname, regmatch_t regs[]); @@ -100,20 +100,20 @@ void free_bregexps(alist *bregexps); /* you have to free alist */ /* get regexp size */ int bregexp_get_build_where_size(char *strip_prefix, - char *add_prefix, - char *add_suffix); + char *add_prefix, + char *add_suffix); /* get a bregexp string from user arguments * you must allocate it with bregexp_get_build_where_size(); */ char *bregexp_build_where(char *dest, int str_size, - char *strip_prefix, + char *strip_prefix, char *add_prefix, char *add_suffix); /* escape a string to regexp format (sep and \) * dest must be long enough (dest = 2*src + 1) */ -char *bregexp_escape_string(char *dest, char *src, char sep); +char *bregexp_escape_string(char *dest, const char *src, const char sep); #endif /* __BREG_H_ */ diff --git a/bacula/src/lib/bsnprintf.c b/bacula/src/lib/bsnprintf.c index f8f88aea6b..920fdb1b24 100644 --- a/bacula/src/lib/bsnprintf.c +++ b/bacula/src/lib/bsnprintf.c @@ -63,7 +63,7 @@ int bvsnprintf(char *buffer, int32_t maxlen, const char *format, va_list args); static int32_t fmtstr(char *buffer, int32_t currlen, int32_t maxlen, - char *value, int flags, int min, int max); + const char *value, int flags, int min, int max); static int32_t fmtint(char *buffer, int32_t currlen, int32_t maxlen, int64_t value, int base, int min, int max, int flags); @@ -396,7 +396,7 @@ int bvsnprintf(char *buffer, int32_t maxlen, const char *format, va_list args) } static int32_t fmtstr(char *buffer, int32_t currlen, int32_t maxlen, - char *value, int flags, int min, int max) + const char *value, int flags, int min, int max) { int padlen, strln; /* amount to pad */ int cnt = 0; diff --git a/bacula/src/lib/edit.c b/bacula/src/lib/edit.c index 5c3bfdbb00..89768f5d94 100644 --- a/bacula/src/lib/edit.c +++ b/bacula/src/lib/edit.c @@ -120,7 +120,7 @@ char *edit_uint64_with_suffix(uint64_t val, char *buf) { int commas = 0; char *c, mbuf[50]; - char *suffix[] = + const char *suffix[] = { "", "K", "M", "G", "T", "P", "E", "Z", "Y", "FIX ME" }; int suffixes = sizeof(suffix) / sizeof(*suffix); diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index 69a431d699..58921659da 100644 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -416,14 +416,15 @@ static void free_common_jcr(JCR *jcr) #ifdef DEBUG void b_free_jcr(const char *file, int line, JCR *jcr) { - Dmsg3(dbglvl, "Enter free_jcr 0x%x from %s:%d\n", jcr, file, line); + Dmsg3(dbglvl, "Enter free_jcr jid=%u from %s:%d\n", jcr->JobId, file, line); #else void free_jcr(JCR *jcr) { - Dmsg2(dbglvl, "Enter free_jcr 0x%x job=%d\n", jcr, jcr->JobId); + Dmsg3(dbglvl, "Enter free_jcr jid=%u use_count=%d Job=%s\n", + jcr->JobId, jcr->use_count(), jcr->Job); #endif @@ -434,13 +435,18 @@ void free_jcr(JCR *jcr) Emsg2(M_ERROR, 0, _("JCR use_count=%d JobId=%d\n"), jcr->use_count(), jcr->JobId); } - Dmsg3(dbglvl, "Dec free_jcr 0x%x use_count=%d jobid=%d\n", jcr, jcr->use_count(), jcr->JobId); + if (jcr->JobId > 0) { + Dmsg3(dbglvl, "Dec free_jcr jid=%u use_count=%d Job=%s\n", + jcr->JobId, jcr->use_count(), jcr->Job); + } if (jcr->use_count() > 0) { /* if in use */ unlock_jcr_chain(); - Dmsg3(dbglvl, "free_jcr 0x%x job=%d use_count=%d\n", jcr, jcr->JobId, jcr->use_count()); return; } - + if (jcr->JobId > 0) { + Dmsg3(dbglvl, "remove jcr jid=%u use_count=%d Job=%s\n", + jcr->JobId, jcr->use_count(), jcr->Job); + } remove_jcr(jcr); /* remove Jcr from chain */ unlock_jcr_chain(); @@ -515,7 +521,8 @@ JCR *get_jcr_by_id(uint32_t JobId) foreach_jcr(jcr) { if (jcr->JobId == JobId) { jcr->inc_use_count(); - Dmsg2(dbglvl, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count()); + Dmsg3(dbglvl, "Inc get_jcr jid=%u use_count=%d Job=%s\n", + jcr->JobId, jcr->use_count(), jcr->Job); break; } } @@ -536,7 +543,8 @@ JCR *get_jcr_by_session(uint32_t SessionId, uint32_t SessionTime) if (jcr->VolSessionId == SessionId && jcr->VolSessionTime == SessionTime) { jcr->inc_use_count(); - Dmsg2(dbglvl, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count()); + Dmsg3(dbglvl, "Inc get_jcr jid=%u use_count=%d Job=%s\n", + jcr->JobId, jcr->use_count(), jcr->Job); break; } } @@ -564,7 +572,8 @@ JCR *get_jcr_by_partial_name(char *Job) foreach_jcr(jcr) { if (strncmp(Job, jcr->Job, len) == 0) { jcr->inc_use_count(); - Dmsg2(dbglvl, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count()); + Dmsg3(dbglvl, "Inc get_jcr jid=%u use_count=%d Job=%s\n", + jcr->JobId, jcr->use_count(), jcr->Job); break; } } @@ -589,7 +598,8 @@ JCR *get_jcr_by_full_name(char *Job) foreach_jcr(jcr) { if (strcmp(jcr->Job, Job) == 0) { jcr->inc_use_count(); - Dmsg2(dbglvl, "Inc get_jcr 0x%x use_count=%d\n", jcr, jcr->use_count()); + Dmsg3(dbglvl, "Inc get_jcr jid=%u use_count=%d Job=%s\n", + jcr->JobId, jcr->use_count(), jcr->Job); break; } } @@ -686,7 +696,10 @@ JCR *jcr_walk_start() jcr = (JCR *)jcrs->first(); if (jcr) { jcr->inc_use_count(); - Dmsg3(dbglvl, "Inc jcr_walk_start 0x%x job=%d use_count=%d\n", jcr, jcr->JobId, jcr->use_count()); + if (jcr->JobId > 0) { + Dmsg3(dbglvl, "Inc walk_start jid=%u use_count=%d Job=%s\n", + jcr->JobId, jcr->use_count(), jcr->Job); + } } unlock_jcr_chain(); return jcr; @@ -703,7 +716,10 @@ JCR *jcr_walk_next(JCR *prev_jcr) jcr = (JCR *)jcrs->next(prev_jcr); if (jcr) { jcr->inc_use_count(); - Dmsg3(dbglvl, "Inc jcr_walk_next 0x%x job=%d use_count=%d\n", jcr, jcr->JobId, jcr->use_count()); + if (jcr->JobId > 0) { + Dmsg3(dbglvl, "Inc walk_next jid=%u use_count=%d Job=%s\n", + jcr->JobId, jcr->use_count(), jcr->Job); + } } unlock_jcr_chain(); if (prev_jcr) { @@ -718,6 +734,10 @@ JCR *jcr_walk_next(JCR *prev_jcr) void jcr_walk_end(JCR *jcr) { if (jcr) { + if (jcr->JobId > 0) { + Dmsg3(dbglvl, "Free walk_end jid=%u use_count=%d Job=%s\n", + jcr->JobId, jcr->use_count(), jcr->Job); + } free_jcr(jcr); } } diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 8cccb87339..1ce1f85fc6 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -600,7 +600,7 @@ void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg) int len, dtlen; MSGS *msgs; BPIPE *bpipe; - char *mode; + const char *mode; Dmsg2(850, "Enter dispatch_msg type=%d msg=%s", type, msg); diff --git a/bacula/src/lib/parse_conf.h b/bacula/src/lib/parse_conf.h index a7a5d59e10..470ac52818 100644 --- a/bacula/src/lib/parse_conf.h +++ b/bacula/src/lib/parse_conf.h @@ -134,7 +134,7 @@ RES **new_res_head(); /* Resource routines */ -RES *GetResWithName(int rcode, char *name); +RES *GetResWithName(int rcode, const char *name); RES *GetNextRes(int rcode, RES *res); void b_LockRes(const char *file, int line); void b_UnlockRes(const char *file, int line); diff --git a/bacula/src/lib/res.c b/bacula/src/lib/res.c index 59a41e8d8c..886f1a220b 100644 --- a/bacula/src/lib/res.c +++ b/bacula/src/lib/res.c @@ -87,7 +87,7 @@ void b_UnlockRes(const char *file, int line) * Return resource of type rcode that matches name */ RES * -GetResWithName(int rcode, char *name) +GetResWithName(int rcode, const char *name) { RES *res; int rindex = rcode - r_first; diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index 3b2ff04006..f0e1684ce7 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -89,7 +89,7 @@ /* Forward referenced functions */ void set_os_device_parameters(DCR *dcr); static bool dev_get_os_pos(DEVICE *dev, struct mtget *mt_stat); -static char *mode_to_str(int mode); +static const char *mode_to_str(int mode); /* * Allocate and initialize the DEVICE structure @@ -2476,7 +2476,7 @@ static const char *modes[] = { }; -static char *mode_to_str(int mode) +static const char *mode_to_str(int mode) { static char buf[100]; if (mode < 1 || mode > 4) { diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index a95b072a75..75cf2f2d5e 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -185,9 +185,9 @@ bool run_cmd(JCR *jcr) * expires. */ P(mutex); - for ( ; !job_canceled(jcr); ) { + while ( !jcr->authenticated && !job_canceled(jcr) ) { errstat = pthread_cond_timedwait(&jcr->job_start_wait, &mutex, &timeout); - if (errstat == 0 || errstat == ETIMEDOUT) { + if (errstat == ETIMEDOUT || errstat == EINVAL || errstat == EPERM) { break; } } diff --git a/bacula/src/tools/testfind.c b/bacula/src/tools/testfind.c index a14799a9a6..184580604b 100644 --- a/bacula/src/tools/testfind.c +++ b/bacula/src/tools/testfind.c @@ -87,8 +87,8 @@ int main (int argc, char *const *argv) { FF_PKT *ff; - char *configfile = "bacula-dir.conf"; - char *fileset_name = "Windows-Full-Set"; + const char *configfile = "bacula-dir.conf"; + const char *fileset_name = "Windows-Full-Set"; int ch, hard_links; OSDependentInit(); diff --git a/bacula/src/version.h b/bacula/src/version.h index 6d5be57357..04823a8c98 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "2.3.5" -#define BDATE "26 September 2007" -#define LSMDATE "26Sep07" +#define VERSION "2.3.6" +#define BDATE "27 September 2007" +#define LSMDATE "27Sep07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index c82b284a76..e0a53e3712 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -2,6 +2,9 @@ General: 27Sep07 +kes Fix FD->SD authorization failure, which was due to spurious + wakeups from a pthread_cond_timedwait(). Simply check the + predicate before continuing. kes Add const char where needed (more to do). Remove temp debug code. 26Sep07 kes Setup SQLite busy handler before doing queries. -- 2.39.5