From 2df930772a4e8ea92684aea82c3e5cf8a11e55ef Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 6 Mar 2009 20:00:47 +0000 Subject: [PATCH] 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 --- bacula/src/dird/backup.c | 16 ++++++++-------- bacula/src/dird/job.c | 2 +- bacula/src/dird/migrate.c | 6 +++--- bacula/src/dird/restore.c | 4 ++-- bacula/src/dird/ua_dotcmds.c | 4 ++++ bacula/src/dird/vbackup.c | 6 +++--- bacula/src/dird/verify.c | 6 +++--- bacula/src/filed/backup.c | 20 ++++++++++---------- bacula/src/filed/job.c | 12 ++++++------ bacula/src/filed/status.c | 2 +- bacula/src/filed/verify.c | 16 ++++++++-------- bacula/src/filed/xattr.c | 4 ++-- bacula/src/jcr.h | 3 +-- bacula/src/lib/jcr.c | 2 +- bacula/src/lib/message.c | 2 +- bacula/src/win32/Makefile | 2 +- bacula/src/win32/README.mingw32 | 12 ++++++------ bacula/src/win32/cats/bacula_cats.def | 4 ++-- bacula/src/win32/compat/compat.h | 7 ++++++- bacula/src/win32/compat/print.cpp | 13 ++++++++++--- bacula/src/win32/dll/bacula.def | 2 +- bacula/technotes-2.5 | 6 ++++++ 22 files changed, 86 insertions(+), 65 deletions(-) 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/src/win32/Makefile b/bacula/src/win32/Makefile index 78eae5572f..2b83bdc02b 100644 --- a/bacula/src/win32/Makefile +++ b/bacula/src/win32/Makefile @@ -1,6 +1,6 @@ ECHO_CMD=@ -DIRS= dll \ +DIRS= lib \ cats \ filed \ filed/plugins \ diff --git a/bacula/src/win32/README.mingw32 b/bacula/src/win32/README.mingw32 index 18961152e2..d43c87a9ab 100644 --- a/bacula/src/win32/README.mingw32 +++ b/bacula/src/win32/README.mingw32 @@ -222,7 +222,7 @@ Exporting functions is now more or less automated. If you find that a function name has been added, changed, or an argument modified, simply do the following: - cd .../bacula/src/win32/dll + cd .../bacula/src/win32/lib make (to build the .o files, note the link will fail) ./make_def >bacula.def @@ -237,24 +237,24 @@ If you want to do it manually, please see below: Exporting a function requires a bit more work. You must determine the C++ mangled name of the new function. - strings .../bacula/src/win32/dll/.o | grep + strings .../bacula/src/win32/lib/.o | grep Note, strings often will not show the desired symbol. In that case, use: - nm .../bacula/src/win32/dll/.o + nm .../bacula/src/win32/lib/.o Replace with the base part of the name of the source code file which contains the new function. Replace with the name of the new function. Remove the leading underscore and place the result in the file - .../bacula/src/win32/dll/bacula.def + .../bacula/src/win32/lib/bacula.def === end manual changing of bacula.def ========== If you add a new file, you will need to specify its name in - .../bacula/src/win32/dll/Makefile + .../bacula/src/win32/lib/Makefile and .../bacula/src/win32/libbac/Makefile @@ -299,7 +299,7 @@ C++ mangled name of the new function. Note, strings often will not show the desired symbol. In that case, use: - nm .../bacula/src/win32/dll/.o + nm .../bacula/src/win32/lib/.o Replace with the base part of the name of the source code file which contains the new function. Replace with the name of diff --git a/bacula/src/win32/cats/bacula_cats.def b/bacula/src/win32/cats/bacula_cats.def index fb4c888b91..e70c7958a9 100644 --- a/bacula/src/win32/cats/bacula_cats.def +++ b/bacula/src/win32/cats/bacula_cats.def @@ -85,7 +85,7 @@ _Z24db_list_jobmedia_recordsP3JCRP4B_DBjPFvPvPKcES3_11e_list_type ; sql_update.o _Z15db_update_statsP3JCRP4B_DBx -_Z19db_mark_file_recordP3JCRP4B_DBjj +_Z19db_mark_file_recordP3JCRP4B_DByj _Z21db_update_pool_recordP3JCRP4B_DBP8POOL_DBR _Z22db_update_media_recordP3JCRP4B_DBP9MEDIA_DBR _Z23db_update_client_recordP3JCRP4B_DBP10CLIENT_DBR @@ -95,7 +95,7 @@ _Z24db_update_job_end_recordP3JCRP4B_DBP7JOB_DBR _Z24db_update_media_defaultsP3JCRP4B_DBP9MEDIA_DBR _Z24db_update_storage_recordP3JCRP4B_DBP11STORAGE_DBR _Z26db_update_job_start_recordP3JCRP4B_DBP7JOB_DBR -_Z28db_add_digest_to_file_recordP3JCRP4B_DBjPci +_Z28db_add_digest_to_file_recordP3JCRP4B_DByPci _Z11db_get_typev _Z12db_sql_queryP4B_DBPKcPFiPviPPcES3_ diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index be55b8012a..184e7fe170 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -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. @@ -57,6 +57,10 @@ #include +#ifndef INT64 +#define INT64 long long int +#endif + typedef UINT64 u_int64_t; typedef UINT64 uint64_t; typedef INT64 int64_t; @@ -67,6 +71,7 @@ typedef unsigned short uint16_t; typedef signed short int16_t; typedef signed char int8_t; typedef int __daddr_t; + #if !defined(HAVE_MINGW) typedef long int32_t; typedef float float32_t; diff --git a/bacula/src/win32/compat/print.cpp b/bacula/src/win32/compat/print.cpp index 60fd82bfa7..d648fa14d1 100644 --- a/bacula/src/win32/compat/print.cpp +++ b/bacula/src/win32/compat/print.cpp @@ -333,14 +333,21 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args, prfun outch) break; case 's': strvalue = va_arg(args, char *); - if (max < 0) + if (max < 0) { max = maxlen; /* ie, no max */ + } fmtstr(buffer, &currlen, maxlen, strvalue, flags, min, max, outch); break; case 'p': - strvalue = (char *) va_arg(args, void *); flags |= DP_F_UNSIGNED; - fmtint(buffer, &currlen, maxlen, (INT64) strvalue, 16, min, max, + if (sizeof(char *) == 4) { + value = va_arg(args, uint32_t); + } else if (sizeof(char *) == 8) { + value = va_arg(args, uint64_t); + } else { + value = 0; /* we have a problem */ + } + fmtint(buffer, &currlen, maxlen, value, 16, min, max, flags, outch); break; case 'n': diff --git a/bacula/src/win32/dll/bacula.def b/bacula/src/win32/dll/bacula.def index 4ee012511b..d020257d10 100644 --- a/bacula/src/win32/dll/bacula.def +++ b/bacula/src/win32/dll/bacula.def @@ -84,7 +84,7 @@ _Z17InitWinAPIWrapperv ; attribs.o _Z11decode_statPcP4statPi -_Z11encode_statPcP6FF_PKTi +_Z11encode_statPcP4statii _Z13decode_LinkFIPcP4stat _Z14set_attributesP3JCRP4ATTRP5BFILE _Z16encode_attribsExP3JCRPcP6FF_PKT 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. -- 2.39.5