From: Kern Sibbald Date: Fri, 6 Mar 2009 20:00:47 +0000 (+0000) Subject: kes Fix the Win32 build. X-Git-Tag: Release-7.0.0~3342 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=717d3139e0141ab2294c8b148815f4b376583295;p=bacula%2Fbacula kes Fix the Win32 build. kes Fix broken casting in src/compat/print.cpp. kes Eliminate jcr Errors and always use jcr JobErrors. This should ensure that SD and FD errors are correctly reported. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8502 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index ec430d4494..fddb4b6fa1 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -348,7 +348,7 @@ int wait_for_job_termination(JCR *jcr, int timeout) int32_t n = 0; BSOCK *fd = jcr->file_bsock; bool fd_ok = false; - uint32_t JobFiles, Errors; + uint32_t JobFiles, JobErrors; uint64_t ReadBytes = 0; uint64_t JobBytes = 0; int VSS = 0; @@ -365,9 +365,9 @@ int wait_for_job_termination(JCR *jcr, int timeout) while ((n = bget_dirmsg(fd)) >= 0) { if (!fd_ok && (sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles, - &ReadBytes, &JobBytes, &Errors, &VSS, &Encrypt) == 7 || + &ReadBytes, &JobBytes, &JobErrors, &VSS, &Encrypt) == 7 || sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles, - &ReadBytes, &JobBytes, &Errors) == 5)) { + &ReadBytes, &JobBytes, &JobErrors) == 5)) { fd_ok = true; set_jcr_job_status(jcr, jcr->FDJobStatus); Dmsg1(100, "FDStatus=%c\n", (char)jcr->JobStatus); @@ -395,13 +395,13 @@ int wait_for_job_termination(JCR *jcr, int timeout) cancel_storage_daemon_job(jcr); } - /* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/Errors */ + /* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/JobErrors */ wait_for_storage_daemon_termination(jcr); /* Return values from FD */ if (fd_ok) { jcr->JobFiles = JobFiles; - jcr->Errors = Errors; + jcr->JobErrors += JobErrors; /* Keep total errors */ jcr->ReadBytes = ReadBytes; jcr->JobBytes = JobBytes; jcr->VSS = VSS; @@ -476,7 +476,7 @@ void backup_cleanup(JCR *jcr, int TermCode) switch (jcr->JobStatus) { case JS_Terminated: - if (jcr->Errors || jcr->SDErrors) { + if (jcr->JobErrors || jcr->SDErrors) { term_msg = _("Backup OK -- with warnings"); } else { term_msg = _("Backup OK"); @@ -608,7 +608,7 @@ void backup_cleanup(JCR *jcr, int TermCode) jcr->VolSessionTime, edit_uint64_with_commas(mr.VolBytes, ec7), edit_uint64_with_suffix(mr.VolBytes, ec8), - jcr->Errors, + jcr->JobErrors, jcr->SDErrors, fd_term_msg, sd_term_msg, diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index d70e589226..15a91497f3 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -863,7 +863,7 @@ void update_job_end_record(JCR *jcr) jcr->jr.ReadBytes = jcr->ReadBytes; jcr->jr.VolSessionId = jcr->VolSessionId; jcr->jr.VolSessionTime = jcr->VolSessionTime; - jcr->jr.JobErrors = jcr->Errors; + jcr->jr.JobErrors = jcr->JobErrors; if (!db_update_job_end_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_WARNING, 0, _("Error updating job record. %s"), db_strerror(jcr->db)); diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index f4beca3226..60b9bee04c 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2004-2008 Free Software Foundation Europe e.V. + Copyright (C) 2004-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -397,7 +397,7 @@ bool do_migration(JCR *jcr) set_jcr_job_status(mig_jcr, JS_Running); /* Pickup Job termination data */ - /* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/Errors */ + /* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/JobErrors */ wait_for_storage_daemon_termination(jcr); set_jcr_job_status(jcr, jcr->SDJobStatus); db_write_batch_file_records(jcr); /* used by bulk batch file insert */ @@ -1210,7 +1210,7 @@ void migration_cleanup(JCR *jcr, int TermCode) switch (jcr->JobStatus) { case JS_Terminated: - if (jcr->Errors || jcr->SDErrors) { + if (jcr->JobErrors || jcr->SDErrors) { term_msg = _("%s OK -- with warnings"); } else { term_msg = _("%s OK"); diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index b57e6802df..d58556fc29 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -323,7 +323,7 @@ void restore_cleanup(JCR *jcr, int TermCode) edit_uint64_with_commas((uint64_t)jcr->jr.JobFiles, ec2), edit_uint64_with_commas(jcr->jr.JobBytes, ec3), (float)kbps, - jcr->Errors, + jcr->JobErrors, fd_term_msg, sd_term_msg, term_msg); diff --git a/bacula/src/dird/ua_dotcmds.c b/bacula/src/dird/ua_dotcmds.c index b606970da7..d09c60d378 100644 --- a/bacula/src/dird/ua_dotcmds.c +++ b/bacula/src/dird/ua_dotcmds.c @@ -468,6 +468,10 @@ static int sql_handler(void *ctx, int num_field, char **row) UAContext *ua = (UAContext *)ctx; POOL_MEM rows(PM_MESSAGE); + /* Check for nonsense */ + if (num_field == 0 || row == NULL || row[0] == NULL) { + return 0; /* nothing returned */ + } for (int i=0; num_field--; i++) { if (i == 0) { pm_strcpy(rows, NPRT(row[0])); diff --git a/bacula/src/dird/vbackup.c b/bacula/src/dird/vbackup.c index 18eb34c332..9ae9c65d06 100644 --- a/bacula/src/dird/vbackup.c +++ b/bacula/src/dird/vbackup.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2008-2008 Free Software Foundation Europe e.V. + Copyright (C) 2008-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -267,7 +267,7 @@ _("This Job is not an Accurate backup so is not equivalent to a Full backup.\n") set_jcr_job_status(jcr, JS_Running); /* Pickup Job termination data */ - /* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/Errors */ + /* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/JobErrors */ wait_for_storage_daemon_termination(jcr); set_jcr_job_status(jcr, jcr->SDJobStatus); db_write_batch_file_records(jcr); /* used by bulk batch file insert */ @@ -339,7 +339,7 @@ void vbackup_cleanup(JCR *jcr, int TermCode) switch (jcr->JobStatus) { case JS_Terminated: - if (jcr->Errors || jcr->SDErrors) { + if (jcr->JobErrors || jcr->SDErrors) { term_msg = _("Backup OK -- with warnings"); } else { term_msg = _("Backup OK"); diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 3f1e57b521..790f9ee504 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -462,7 +462,7 @@ void verify_cleanup(JCR *jcr, int TermCode) edt, edit_uint64_with_commas(jcr->ExpectedFiles, ec1), edit_uint64_with_commas(jcr->JobFiles, ec2), - jcr->Errors, + jcr->JobErrors, fd_term_msg, sd_term_msg, term_msg); @@ -494,7 +494,7 @@ void verify_cleanup(JCR *jcr, int TermCode) sdt, edt, edit_uint64_with_commas(jcr->JobFiles, ec1), - jcr->Errors, + jcr->JobErrors, fd_term_msg, term_msg); } diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index 9a5db19fbf..43d98cf9c0 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -367,21 +367,21 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) berrno be; Jmsg(jcr, M_NOTSAVED, 0, _(" Could not access \"%s\": ERR=%s\n"), ff_pkt->fname, be.bstrerror(ff_pkt->ff_errno)); - jcr->Errors++; + jcr->JobErrors++; return 1; } case FT_NOFOLLOW: { berrno be; Jmsg(jcr, M_NOTSAVED, 0, _(" Could not follow link \"%s\": ERR=%s\n"), ff_pkt->fname, be.bstrerror(ff_pkt->ff_errno)); - jcr->Errors++; + jcr->JobErrors++; return 1; } case FT_NOSTAT: { berrno be; Jmsg(jcr, M_NOTSAVED, 0, _(" Could not stat \"%s\": ERR=%s\n"), ff_pkt->fname, be.bstrerror(ff_pkt->ff_errno)); - jcr->Errors++; + jcr->JobErrors++; return 1; } case FT_DIRNOCHG: @@ -395,13 +395,13 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) berrno be; Jmsg(jcr, M_NOTSAVED, 0, _(" Could not open directory \"%s\": ERR=%s\n"), ff_pkt->fname, be.bstrerror(ff_pkt->ff_errno)); - jcr->Errors++; + jcr->JobErrors++; return 1; } default: Jmsg(jcr, M_NOTSAVED, 0, _(" Unknown file type %d; not saved: %s\n"), ff_pkt->type, ff_pkt->fname); - jcr->Errors++; + jcr->JobErrors++; return 1; } @@ -455,7 +455,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) if (signing_digest == NULL) { Jmsg(jcr, M_NOTSAVED, 0, _("%s signature digest initialization failed\n"), stream_to_ascii(signing_algorithm)); - jcr->Errors++; + jcr->JobErrors++; goto good_rtn; } } @@ -527,7 +527,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) berrno be; Jmsg(jcr, M_NOTSAVED, 0, _(" Cannot open \"%s\": ERR=%s.\n"), ff_pkt->fname, be.bstrerror()); - jcr->Errors++; + jcr->JobErrors++; if (tid) { stop_thread_timer(tid); tid = NULL; @@ -564,7 +564,7 @@ int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) berrno be; Jmsg(jcr, M_NOTSAVED, -1, _(" Cannot open resource fork for \"%s\": ERR=%s.\n"), ff_pkt->fname, be.bstrerror()); - jcr->Errors++; + jcr->JobErrors++; if (is_bopen(&ff_pkt->bfd)) { bclose(&ff_pkt->bfd); } @@ -977,7 +977,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, berrno be; Jmsg(jcr, M_ERROR, 0, _("Read error on file %s. ERR=%s\n"), ff_pkt->fname, be.bstrerror(ff_pkt->bfd.berrno)); - if (jcr->Errors++ > 1000) { /* insanity check */ + if (jcr->JobErrors++ > 1000) { /* insanity check */ Jmsg(jcr, M_FATAL, 0, _("Too many errors.\n")); } } else if (ff_pkt->flags & FO_ENCRYPT) { diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index ecbc2de3b0..94005ffe87 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -276,7 +276,7 @@ void *handle_client_request(void *dirp) /* Send termination status back to Dir */ dir->fsend(EndJob, jcr->JobStatus, jcr->JobFiles, edit_uint64(jcr->ReadBytes, ed1), - edit_uint64(jcr->JobBytes, ed2), jcr->Errors, jcr->VSS, + edit_uint64(jcr->JobBytes, ed2), jcr->JobErrors, jcr->VSS, jcr->crypto.pki_encrypt); Dmsg1(110, "End FD msg: %s\n", dir->msg); } @@ -1491,21 +1491,21 @@ static int backup_cmd(JCR *jcr) Jmsg(jcr, M_INFO, 0, _("Generate VSS snapshots. Driver=\"%s\", Drive(s)=\"%s\"\n"), g_pVSSClient->GetDriverName(), szWinDriveLetters); if (!g_pVSSClient->CreateSnapshots(szWinDriveLetters)) { Jmsg(jcr, M_WARNING, 0, _("Generate VSS snapshots failed.\n")); - jcr->Errors++; + jcr->JobErrors++; } else { /* tell user if snapshot creation of a specific drive failed */ int i; for (i=0; i < (int)strlen(szWinDriveLetters); i++) { if (islower(szWinDriveLetters[i])) { Jmsg(jcr, M_WARNING, 0, _("Generate VSS snapshot of drive \"%c:\\\" failed. VSS support is disabled on this drive.\n"), szWinDriveLetters[i]); - jcr->Errors++; + jcr->JobErrors++; } } /* inform user about writer states */ for (i=0; i < (int)g_pVSSClient->GetWriterCount(); i++) if (g_pVSSClient->GetWriterState(i) < 1) { Jmsg(jcr, M_WARNING, 0, _("VSS Writer (PrepareForBackup): %s\n"), g_pVSSClient->GetWriterInfo(i)); - jcr->Errors++; + jcr->JobErrors++; } } } else { @@ -1584,7 +1584,7 @@ cleanup: int msg_type = M_INFO; if (g_pVSSClient->GetWriterState(i) < 1) { msg_type = M_WARNING; - jcr->Errors++; + jcr->JobErrors++; } Jmsg(jcr, msg_type, 0, _("VSS Writer (BackupComplete): %s\n"), g_pVSSClient->GetWriterInfo(i)); } @@ -1770,7 +1770,7 @@ static int restore_cmd(JCR *jcr) bail_out: - if (jcr->Errors) { + if (jcr->JobErrors) { set_jcr_job_status(jcr, JS_ErrorTerminated); } diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index 4ee3c13685..78d447cf71 100644 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2001-2008 Free Software Foundation Europe e.V. + Copyright (C) 2001-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/filed/verify.c b/bacula/src/filed/verify.c index 2d0d8e753b..8f50f78cdb 100644 --- a/bacula/src/filed/verify.c +++ b/bacula/src/filed/verify.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -120,21 +120,21 @@ static int verify_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) berrno be; be.set_errno(ff_pkt->ff_errno); Jmsg(jcr, M_NOTSAVED, 1, _(" Could not access %s: ERR=%s\n"), ff_pkt->fname, be.bstrerror()); - jcr->Errors++; + jcr->JobErrors++; return 1; } case FT_NOFOLLOW: { berrno be; be.set_errno(ff_pkt->ff_errno); Jmsg(jcr, M_NOTSAVED, 1, _(" Could not follow link %s: ERR=%s\n"), ff_pkt->fname, be.bstrerror()); - jcr->Errors++; + jcr->JobErrors++; return 1; } case FT_NOSTAT: { berrno be; be.set_errno(ff_pkt->ff_errno); Jmsg(jcr, M_NOTSAVED, 1, _(" Could not stat %s: ERR=%s\n"), ff_pkt->fname, be.bstrerror()); - jcr->Errors++; + jcr->JobErrors++; return 1; } case FT_DIRNOCHG: @@ -155,12 +155,12 @@ static int verify_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) berrno be; be.set_errno(ff_pkt->ff_errno); Jmsg(jcr, M_NOTSAVED, 1, _(" Could not open directory %s: ERR=%s\n"), ff_pkt->fname, be.bstrerror()); - jcr->Errors++; + jcr->JobErrors++; return 1; } default: Jmsg(jcr, M_NOTSAVED, 0, _(" Unknown file type %d: %s\n"), ff_pkt->type, ff_pkt->fname); - jcr->Errors++; + jcr->JobErrors++; return 1; } @@ -247,7 +247,7 @@ static int verify_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) size = sizeof(md); if (digest_file(jcr, ff_pkt, digest) != 0) { - jcr->Errors++; + jcr->JobErrors++; goto good_rtn; } @@ -370,7 +370,7 @@ static int read_digest(BFILE *bfd, DIGEST *digest, JCR *jcr) Dmsg2(100, "Error reading file %s: ERR=%s\n", jcr->last_fname, be.bstrerror()); Jmsg(jcr, M_ERROR, 1, _("Error reading file %s: ERR=%s\n"), jcr->last_fname, be.bstrerror()); - jcr->Errors++; + jcr->JobErrors++; return -1; } return 0; diff --git a/bacula/src/filed/xattr.c b/bacula/src/filed/xattr.c index f03aad6a1e..2b01bff2d8 100644 --- a/bacula/src/filed/xattr.c +++ b/bacula/src/filed/xattr.c @@ -244,8 +244,8 @@ static bool generic_xattr_build_streams(JCR *jcr, FF_PKT *ff_pkt, int stream) { int count = 0; int32_t xattr_list_len, - xattr_value_len, - expected_serialize_len = 0; + xattr_value_len; + uint32_t expected_serialize_len = 0; char *xattr_list, *bp; xattr_t *xattr_value_list, *current_xattr; diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index d0a0cb63f9..4c9ef8a77b 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -209,11 +209,10 @@ public: uint32_t VolSessionId; uint32_t VolSessionTime; uint32_t JobFiles; /* Number of files written, this job */ - uint32_t JobErrors; /* */ + uint32_t JobErrors; /* Number of non-fatal errors this job */ uint64_t JobBytes; /* Number of bytes processed this job */ uint64_t ReadBytes; /* Bytes read -- before compression */ FileId_t FileId; /* Last FileId used */ - uint32_t Errors; /* Number of non-fatal errors */ volatile int32_t JobStatus; /* ready, running, blocked, terminated */ int32_t JobPriority; /* Job priority */ time_t sched_time; /* job schedule time, i.e. when it should start */ diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index e1209b2983..32b6aabd3b 100644 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -538,7 +538,7 @@ void free_jcr(JCR *jcr) num_jobs_run++; je = (struct s_last_job *)malloc(sizeof(struct s_last_job)); memset(je, 0, sizeof(struct s_last_job)); /* zero in case unset fields */ - je->Errors = jcr->Errors; + je->Errors = jcr->JobErrors; je->JobType = jcr->get_JobType(); je->JobId = jcr->JobId; je->VolSessionId = jcr->VolSessionId; diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 2ca4ab6322..1ad19cb3af 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -1144,7 +1144,7 @@ Jmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...) case M_ERROR: len = bsnprintf(rbuf, sizeof(rbuf), _("%s JobId %u: Error: "), my_name, JobId); if (jcr) { - jcr->Errors++; + jcr->JobErrors++; } break; case M_WARNING: diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index a8e3f82d69..173eb38ab2 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -25,6 +25,12 @@ filepattern (restore with regex in bsr) mixed priorities General: +06Mar09 +kes Move src/win32/dll to src/win32/lib, which is much more logical. +kes Fix the Win32 build. +kes Fix broken casting in src/compat/print.cpp. +kes Eliminate jcr Errors and always use jcr JobErrors. This should + ensure that SD and FD errors are correctly reported. 28Feb09 mvw Implemented xattr support for Solaris 9 and above and extensible attributes for OpenSolaris.