From: Kern Sibbald Date: Wed, 4 Dec 2002 17:29:01 +0000 (+0000) Subject: Fix termination status on restore X-Git-Tag: Release-1.28~36 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=347e8b3f26422571aefd5b6a83d3e955d9855475;p=bacula%2Fbacula Fix termination status on restore git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@230 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index deaf6ac588..c42cb4c63b 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -1,5 +1,5 @@ Kern's ToDo List - 2 December 2002 + 5 December 2002 Documentation to do: (a little bit at a time) - Document running a test version. @@ -8,7 +8,6 @@ Documentation to do: (a little bit at a time) Testing to do: (painful) - that restore options work in FD. -- that mod of restore options works. - that console command line options work - blocksize recognition code. - Test new BSR code @@ -618,3 +617,5 @@ Done: (see kernsdone for more) - Put Bacula version somewhere in Job stream, probably Start Session Labels. - Fix start/end blocks for File devices - Make Job err if WriteBootstrap fails. +- Test that mod of restore options works. +- Test that week position schedule code works. diff --git a/bacula/src/stored/match_bsr.c b/bacula/src/stored/match_bsr.c index 9798157601..41aa8daa87 100755 --- a/bacula/src/stored/match_bsr.c +++ b/bacula/src/stored/match_bsr.c @@ -55,10 +55,15 @@ static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, SESSION_LA */ int match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, SESSION_LABEL *sessrec) { - if (!bsr) { - return 0; + int stat; + + if (bsr) { + stat = match_all(bsr, rec, volrec, sessrec, 1); + } else { + stat = 0; } - return match_all(bsr, rec, volrec, sessrec, 1); +// Dmsg1(000, "BSR returning %d\n", stat); + return stat; } /* diff --git a/bacula/src/stored/read.c b/bacula/src/stored/read.c index 9a36388519..34cbd58d1c 100644 --- a/bacula/src/stored/read.c +++ b/bacula/src/stored/read.c @@ -55,6 +55,7 @@ int do_read_data(JCR *jcr) BSOCK *ds; BSOCK *fd_sock = jcr->file_bsock; int ok = TRUE; + int done = FALSE; DEVICE *dev; DEV_RECORD *rec; DEV_BLOCK *block; @@ -112,7 +113,7 @@ int do_read_data(JCR *jcr) * Read records, apply BSR filtering, and return any that are * matched. */ - for ( ;ok; ) { + for ( ;ok && !done; ) { if (job_cancelled(jcr)) { ok = FALSE; break; @@ -171,7 +172,7 @@ int do_read_data(JCR *jcr) if (jcr->bsr) { int stat = match_bsr(jcr->bsr, rec, &dev->VolHdr, &sessrec); if (stat == -1) { /* no more possible matches */ - ok = FALSE; + done = TRUE; break; } else if (stat == 0) { /* no match */ Dmsg0(50, "BSR rejected record\n"); @@ -197,6 +198,9 @@ int do_read_data(JCR *jcr) * out the data record */ ds->msg = hdr; + Dmsg5(400, "Send to FD: SessId=%u SessTim=%u FI=%d Strm=%d, len=%d\n", + rec->VolSessionId, rec->VolSessionTime, rec->FileIndex, rec->Stream, + rec->data_len); if (!bnet_fsend(ds, rec_header, rec->VolSessionId, rec->VolSessionTime, rec->FileIndex, rec->Stream, rec->data_len)) { Dmsg1(30, ">filed: Error Hdr=%s\n", ds->msg); diff --git a/bacula/src/stored/read_record.c b/bacula/src/stored/read_record.c index ace357c879..de5d6050b3 100644 --- a/bacula/src/stored/read_record.c +++ b/bacula/src/stored/read_record.c @@ -44,11 +44,12 @@ int read_records(JCR *jcr, DEVICE *dev, uint32_t record, num_files = 0; int verbose = FALSE; int ok = TRUE; + int done = FALSE; SESSION_LABEL sessrec; block = new_block(dev); rec = new_record(); - for ( ;ok; ) { + for ( ;ok && !done; ) { if (job_cancelled(jcr)) { ok = FALSE; break; @@ -158,7 +159,7 @@ next_record: if (jcr->bsr) { int stat = match_bsr(jcr->bsr, rec, &dev->VolHdr, &sessrec); if (stat == -1) { /* no more possible matches */ - ok = FALSE; + done = TRUE; /* all items found, stop */ break; } else if (stat == 0) { /* no match */ if (verbose) {