From 06668daffa6f0d22c539633195dee459e92f6173 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 18 Jul 2004 09:23:42 +0000 Subject: [PATCH] Some Win32 fixes git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1480 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/configure.in | 1 - bacula/configure | 3 +-- bacula/kernstodo | 3 ++- bacula/scripts/mtx-changer.in | 3 +++ bacula/src/dird/job.c | 13 +++++++++---- bacula/src/dird/protos.h | 2 +- bacula/src/dird/ua_restore.c | 2 -- bacula/src/dird/ua_run.c | 16 +++++++++------- bacula/src/findlib/find.c | 2 ++ bacula/src/version.h | 4 ++-- 10 files changed, 29 insertions(+), 20 deletions(-) diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 35b024b28b..fff33f7ac1 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -1625,7 +1625,6 @@ AC_OUTPUT([autoconf/Make.common \ scripts/gconsole \ scripts/bacula \ scripts/devel_bacula \ - scripts/fd \ scripts/Makefile \ scripts/logrotate \ scripts/bacula.desktop.gnome1 \ diff --git a/bacula/configure b/bacula/configure index 4bf687d9db..a355cebc11 100755 --- a/bacula/configure +++ b/bacula/configure @@ -18368,7 +18368,7 @@ if test "x${subsysdir}" = "x${sbindir}" ; then exit 1 fi - ac_config_files="$ac_config_files autoconf/Make.common Makefile rescue/Makefile rescue/linux/Makefile rescue/freebsd/Makefile rescue/solaris/Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/devel_bacula scripts/fd scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/gnome-console.console_apps scripts/mtx-changer doc/Makefile src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome-console/Makefile src/gnome-console/gnome-console.conf src/gnome2-console/Makefile src/gnome2-console/gnome-console.conf src/wx-console/Makefile src/wx-console/wx-console.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/filed/win32/Makefile src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/tools/Makefile src/win32/winbacula.nsi src/win32/baculafd/bacula-fd.conf src/win32/Makefile src/win32/console/bconsole.conf src/win32/wx-console/wx-console.conf $PFILES" + ac_config_files="$ac_config_files autoconf/Make.common Makefile rescue/Makefile rescue/linux/Makefile rescue/freebsd/Makefile rescue/solaris/Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/gnome-console.console_apps scripts/mtx-changer doc/Makefile src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome-console/Makefile src/gnome-console/gnome-console.conf src/gnome2-console/Makefile src/gnome2-console/gnome-console.conf src/wx-console/Makefile src/wx-console/wx-console.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/filed/win32/Makefile src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/tools/Makefile src/win32/winbacula.nsi src/win32/baculafd/bacula-fd.conf src/win32/Makefile src/win32/console/bconsole.conf src/win32/wx-console/wx-console.conf $PFILES" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -18912,7 +18912,6 @@ do "scripts/gconsole" ) CONFIG_FILES="$CONFIG_FILES scripts/gconsole" ;; "scripts/bacula" ) CONFIG_FILES="$CONFIG_FILES scripts/bacula" ;; "scripts/devel_bacula" ) CONFIG_FILES="$CONFIG_FILES scripts/devel_bacula" ;; - "scripts/fd" ) CONFIG_FILES="$CONFIG_FILES scripts/fd" ;; "scripts/Makefile" ) CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "scripts/logrotate" ) CONFIG_FILES="$CONFIG_FILES scripts/logrotate" ;; "scripts/bacula.desktop.gnome1" ) CONFIG_FILES="$CONFIG_FILES scripts/bacula.desktop.gnome1" ;; diff --git a/bacula/kernstodo b/bacula/kernstodo index 254d5dcc3c..2f7c3ee53c 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -2,7 +2,7 @@ 14 July 2004 1.35 Items to do: -- Make sure that all errors from libacl are printed. +- Fix GROUP BYs in all SQL. - Add new DCR calling sequences everywhere in SD. This will permit simultaneous use of multiple devices by a single job. @@ -1100,3 +1100,4 @@ Block Position: 0 - Add priority to Scheduled jobs status listing. - Look at Win32 inc problem when new directory added files not saved??? - Require resource names to be unique. +- Make sure that all errors from libacl are printed. diff --git a/bacula/scripts/mtx-changer.in b/bacula/scripts/mtx-changer.in index e1c0d4a98b..e4fdee8ba6 100644 --- a/bacula/scripts/mtx-changer.in +++ b/bacula/scripts/mtx-changer.in @@ -38,6 +38,9 @@ MTX=@MTX@ # not running on Linux, you will probably need to # re-write it. # +# If you have a FreeBSD system, you might want to change +# the $(seq 180) to $(jot 180) -- tip from Brian McDonald +# wait_for_drive() { for i in $(seq 180); do # Wait max 180 seconds if mt -f $1 status >/dev/null 2>&1; then diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 0a21271352..bbbefa8997 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -74,10 +74,14 @@ void init_job_server(int max_workers) * Run a job -- typically called by the scheduler, but may also * be called by the UA (Console program). * + * Returns: 0 on failure + * JobId on success + * */ -void run_job(JCR *jcr) +JobId_t run_job(JCR *jcr) { int stat, errstat; + JobId_t JobId = 0; P(jcr->mutex); sm_check(__FILE__, __LINE__, true); @@ -117,7 +121,7 @@ void run_job(JCR *jcr) Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); goto bail_out; } - jcr->JobId = jcr->jr.JobId; + JobId = jcr->JobId = jcr->jr.JobId; Dmsg4(100, "Created job record JobId=%d Name=%s Type=%c Level=%c\n", jcr->JobId, jcr->Job, jcr->jr.JobType, jcr->jr.JobLevel); @@ -126,17 +130,18 @@ void run_job(JCR *jcr) /* Queue the job to be run */ if ((stat = jobq_add(&job_queue, jcr)) != 0) { Jmsg(jcr, M_FATAL, 0, _("Could not add job queue: ERR=%s\n"), strerror(stat)); + JobId = 0; goto bail_out; } Dmsg0(100, "Done run_job()\n"); V(jcr->mutex); - return; + return JobId; bail_out: set_jcr_job_status(jcr, JS_ErrorTerminated); V(jcr->mutex); - return; + return JobId; } diff --git a/bacula/src/dird/protos.h b/bacula/src/dird/protos.h index 5dca711af4..ac61ca9935 100644 --- a/bacula/src/dird/protos.h +++ b/bacula/src/dird/protos.h @@ -87,7 +87,7 @@ extern void create_unique_job_name(JCR *jcr, const char *base_name); extern void update_job_end_record(JCR *jcr); extern bool get_or_create_client_record(JCR *jcr); extern bool get_or_create_fileset_record(JCR *jcr, FILESET_DBR *fsr); -extern void run_job(JCR *jcr); +extern JobId_t run_job(JCR *jcr); extern int cancel_job(UAContext *ua, JCR *jcr); extern void init_jcr_job_record(JCR *jcr); diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 8d5347dbc3..9c9faec58e 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -224,8 +224,6 @@ int restore_cmd(UAContext *ua, const char *cmd) Dmsg1(400, "Submitting: %s\n", ua->cmd); parse_ua_args(ua); run_cmd(ua, ua->cmd); - - bsendmsg(ua, _("Restore command done.\n")); free_rx(&rx); return 1; diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index 6fdd347847..4f02bf6648 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -417,11 +417,7 @@ try_again: /* Run without prompting? */ if (find_arg(ua, _("yes")) > 0) { - Dmsg1(200, "Calling run_job job=%x\n", jcr->job); - run_job(jcr); - free_jcr(jcr); /* release jcr */ - bsendmsg(ua, _("Run command submitted.\n")); - return 1; + goto start_job; } /* @@ -797,10 +793,16 @@ Priority: %d\n"), } if (strncasecmp(ua->cmd, _("yes"), strlen(ua->cmd)) == 0) { + JobId_t JobId; Dmsg1(200, "Calling run_job job=%x\n", jcr->job); - run_job(jcr); +start_job: + JobId = run_job(jcr); free_jcr(jcr); /* release jcr */ - bsendmsg(ua, _("Run command submitted.\n")); + if (JobId == 0) { + bsendmsg(ua, _("Job failed.\n")); + } else { + bsendmsg(ua, _("Job started. JobId=%u\n"), JobId); + } return 1; } diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index f3d4ef9319..0550e73786 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -169,6 +169,7 @@ static bool accept_file(FF_PKT *ff) return true; /* accept file */ } } +#ifndef WIN32 for (k=0; kregex.size(); k++) { const int nmatch = 30; regmatch_t pmatch[nmatch]; @@ -181,6 +182,7 @@ static bool accept_file(FF_PKT *ff) return true; /* accept file */ } } +#endif } for (i=0; iexclude_list.size(); i++) { diff --git a/bacula/src/version.h b/bacula/src/version.h index fa475a3102..af92258e60 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -2,8 +2,8 @@ #undef VERSION #define VERSION "1.35.1" #define VSTRING "1" -#define BDATE "16 July 2004" -#define LSMDATE "16Jul04" +#define BDATE "17 July 2004" +#define LSMDATE "17Jul04" /* Debug flags */ #undef DEBUG -- 2.39.5