From a8e92d5fdfb3633bc9363446780f960ba7b3db20 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 24 Sep 2004 12:30:34 +0000 Subject: [PATCH] - Modify the depend section of each Makefile.in to reference instead of -- bug 118 - Remove the word restore from the Volumes needed message in dird/bsr.c since the message is used for Restore and Verify. - Fix initialization and copying of the storage resource when starting jobs (and in jobq.c when restarting). In some cases jcr->store was not set causing a segfault -- bug 116 git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1612 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/cats/Makefile.in | 18 +++++++++--------- bacula/src/console/Makefile.in | 2 +- bacula/src/dird/Makefile.in | 2 +- bacula/src/dird/bsr.c | 2 +- bacula/src/dird/job.c | 24 ++++++++++++++++++++++++ bacula/src/dird/jobq.c | 3 +-- bacula/src/dird/protos.h | 1 + bacula/src/dird/verify.c | 10 +++++----- bacula/src/filed/Makefile.in | 2 +- bacula/src/findlib/Makefile.in | 2 +- bacula/src/gnome2-console/Makefile.in | 2 +- bacula/src/stored/Makefile.in | 2 +- bacula/src/tools/Makefile.in | 2 +- bacula/src/tray-monitor/Makefile.in | 2 +- bacula/src/wx-console/Makefile.in | 4 ++-- 15 files changed, 51 insertions(+), 27 deletions(-) diff --git a/bacula/src/cats/Makefile.in b/bacula/src/cats/Makefile.in index 0ef1320723..1301e8c94c 100644 --- a/bacula/src/cats/Makefile.in +++ b/bacula/src/cats/Makefile.in @@ -64,20 +64,20 @@ clean: realclean: clean $(RMF) tags - $(RMF) create_bacula_database update_bacula_tables make_bacula_tables - $(RMF) grant_bacula_privileges drop_bacula_tables drop_bacula_database + $(RMF) create_bacula_database update_bacula_tables make_bacula_tables + $(RMF) grant_bacula_privileges drop_bacula_tables drop_bacula_database - $(RMF) create_bdb_database update_bdb_tables make_bdb_tables - $(RMF) grant_bdb_privileges drop_bdb_tables drop_bdb_database + $(RMF) create_bdb_database update_bdb_tables make_bdb_tables + $(RMF) grant_bdb_privileges drop_bdb_tables drop_bdb_database - $(RMF) create_mysql_database update_mysql_tables make_mysql_tables - $(RMF) grant_mysql_privileges drop_mysql_tables drop_mysql_database + $(RMF) create_mysql_database update_mysql_tables make_mysql_tables + $(RMF) grant_mysql_privileges drop_mysql_tables drop_mysql_database $(RMF) create_postgresql_database update_postgresql_tables make_postgresql_tables $(RMF) grant_postgresql_privileges drop_postgresql_tables drop_postgresql_database - $(RMF) create_sqlite_database update_sqlite_tables make_sqlite_tables - $(RMF) grant_sqlite_privileges drop_sqlite_tables drop_sqlite_database + $(RMF) create_sqlite_database update_sqlite_tables make_sqlite_tables + $(RMF) grant_sqlite_privileges drop_sqlite_tables drop_sqlite_database $(RMF) mysql sqlite $(RMF) make_catalog_backup delete_catalog_backup @@ -136,7 +136,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CC) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ diff --git a/bacula/src/console/Makefile.in b/bacula/src/console/Makefile.in index e3b44e6f3c..838e0a8b83 100644 --- a/bacula/src/console/Makefile.in +++ b/bacula/src/console/Makefile.in @@ -114,7 +114,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CC) -S -M $(CPPFLAGS) $(CONS_INC) -I$(srcdir) -I$(basedir) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(CONS_INC) -I$(srcdir) -I$(basedir) *.c >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ diff --git a/bacula/src/dird/Makefile.in b/bacula/src/dird/Makefile.in index 704d1c2f77..cd24084c50 100644 --- a/bacula/src/dird/Makefile.in +++ b/bacula/src/dird/Makefile.in @@ -132,7 +132,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CC) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ diff --git a/bacula/src/dird/bsr.c b/bacula/src/dird/bsr.c index 664bf4fe8b..a9c582c41d 100644 --- a/bacula/src/dird/bsr.c +++ b/bacula/src/dird/bsr.c @@ -200,7 +200,7 @@ int write_bsr_file(UAContext *ua, RBSR *bsr) /* Tell the user what he will need to mount */ bsendmsg(ua, "\n"); - bsendmsg(ua, _("The restore job will require the following Volumes:\n")); + bsendmsg(ua, _("The job will require the following Volumes:\n")); /* Create Unique list of Volumes using prompt list */ start_prompt(ua, ""); for (RBSR *nbsr=bsr; nbsr; nbsr=nbsr->next) { diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 33935436d7..05bd0dcd5d 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -747,6 +747,9 @@ void set_jcr_defaults(JCR *jcr, JOB *job) for (int i=0; istorage[i] = job->storage[i]; } + if (jcr->storage[0]) { + jcr->store = (STORE *)jcr->storage[0]->first(); + } jcr->client = job->client; if (!jcr->client_name) { jcr->client_name = get_pool_memory(PM_NAME); @@ -786,3 +789,24 @@ void set_jcr_defaults(JCR *jcr, JOB *job) } } } + +/* + * copy the storage definitions from an old JCR to a new one + */ +void copy_storage(JCR *new_jcr, JCR *old_jcr) +{ + for (int i=0; i < MAX_STORE; i++) { + if (old_jcr->storage[i]) { + STORE *st; + new_jcr->storage[i] = New(alist(10, not_owned_by_alist)); + foreach_alist(st, old_jcr->storage[i]) { + new_jcr->storage[i]->append(st); + } + } + if (old_jcr->store) { + new_jcr->store = old_jcr->store; + } else if (new_jcr->storage[0]) { + new_jcr->store = (STORE *)new_jcr->storage[0]->first(); + } + } +} diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index 35438cfcf7..12e2c434c1 100755 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -500,8 +500,7 @@ void *jobq_server(void *arg) njcr->reschedule_count = jcr->reschedule_count; njcr->JobLevel = jcr->JobLevel; njcr->JobStatus = jcr->JobStatus; - njcr->pool = jcr->pool; - njcr->store = jcr->store; + copy_storage(njcr, jcr); njcr->messages = jcr->messages; Dmsg0(300, "Call to run new job\n"); V(jq->mutex); diff --git a/bacula/src/dird/protos.h b/bacula/src/dird/protos.h index f021ea54cb..203596c1c6 100644 --- a/bacula/src/dird/protos.h +++ b/bacula/src/dird/protos.h @@ -90,6 +90,7 @@ extern bool get_or_create_fileset_record(JCR *jcr, FILESET_DBR *fsr); extern JobId_t run_job(JCR *jcr); extern int cancel_job(UAContext *ua, JCR *jcr); extern void init_jcr_job_record(JCR *jcr); +extern void copy_storage(JCR *new_jcr, JCR *old_jcr); /* mountreq.c */ extern void mount_request(JCR *jcr, BSOCK *bs, char *buf); diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index efa2f7ea01..6843f5f289 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -59,10 +59,10 @@ static int missing_handler(void *ctx, int num_fields, char **row); /* * Do a verification of the specified files against the Catlaog * - * Returns: 0 on failure - * 1 on success + * Returns: false on failure + * true on success */ -int do_verify(JCR *jcr) +bool do_verify(JCR *jcr) { const char *level, *Name; BSOCK *fd; @@ -345,11 +345,11 @@ int do_verify(JCR *jcr) stat = wait_for_job_termination(jcr); verify_cleanup(jcr, stat); - return 1; + return true; bail_out: verify_cleanup(jcr, JS_ErrorTerminated); - return 0; + return false; } /* diff --git a/bacula/src/filed/Makefile.in b/bacula/src/filed/Makefile.in index ea8260bd68..3909c4a784 100755 --- a/bacula/src/filed/Makefile.in +++ b/bacula/src/filed/Makefile.in @@ -141,7 +141,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CC) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ diff --git a/bacula/src/findlib/Makefile.in b/bacula/src/findlib/Makefile.in index 409a71474d..7d2c71b5d1 100644 --- a/bacula/src/findlib/Makefile.in +++ b/bacula/src/findlib/Makefile.in @@ -81,7 +81,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CC) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ diff --git a/bacula/src/gnome2-console/Makefile.in b/bacula/src/gnome2-console/Makefile.in index 07dc409607..14bd4f762b 100644 --- a/bacula/src/gnome2-console/Makefile.in +++ b/bacula/src/gnome2-console/Makefile.in @@ -122,7 +122,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CC) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(GNOME_INCLUDEDIR) $(SQL_INC) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(GNOME_INCLUDEDIR) $(SQL_INC) *.c >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ diff --git a/bacula/src/stored/Makefile.in b/bacula/src/stored/Makefile.in index de69c1cdcc..cccbc58ce9 100644 --- a/bacula/src/stored/Makefile.in +++ b/bacula/src/stored/Makefile.in @@ -178,7 +178,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CC) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ diff --git a/bacula/src/tools/Makefile.in b/bacula/src/tools/Makefile.in index 41bebb8eca..64dffb6b6c 100644 --- a/bacula/src/tools/Makefile.in +++ b/bacula/src/tools/Makefile.in @@ -96,7 +96,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CC) -S -M $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ diff --git a/bacula/src/tray-monitor/Makefile.in b/bacula/src/tray-monitor/Makefile.in index 5d820f2e11..04e05108a4 100644 --- a/bacula/src/tray-monitor/Makefile.in +++ b/bacula/src/tray-monitor/Makefile.in @@ -91,7 +91,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CC) -S -M $(CPPFLAGS) $(MONITOR_CPPFLAGS) -I$(srcdir) -I$(basedir) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(MONITOR_CPPFLAGS) -I$(srcdir) -I$(basedir) *.c >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ diff --git a/bacula/src/wx-console/Makefile.in b/bacula/src/wx-console/Makefile.in index 0457717cba..0cdd612193 100644 --- a/bacula/src/wx-console/Makefile.in +++ b/bacula/src/wx-console/Makefile.in @@ -69,7 +69,7 @@ all: Makefile wx-console $(MACOSXAPP) # See http://216.239.59.104/search?q=cache:a61SGKgoHSQJ:wiki.wxwidgets.org/wiki.pl%3FWxMac_Issues+wxmac+%22application+bundle%22&hl=fr wx-console.app: wx-console - -mkdir wx-console.app + -mkdir wx-console.app -mkdir wx-console.app/Contents -mkdir wx-console.app/Contents/MacOS -mkdir wx-console.app/Contents/Resources @@ -123,7 +123,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CC) -S -M $(CPPFLAGS) $(CONS_CPPFLAGS) -I$(srcdir) -I$(basedir) $(CONSSRCS) >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(CONS_CPPFLAGS) -I$(srcdir) -I$(basedir) $(CONSSRCS) >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ -- 2.39.5