1 >From f182fe49fca2b2e3009f26fbf6197f8c046835ad Mon Sep 17 00:00:00 2001
2 From: Marco van Wieringen <mvw@planets.elm.net>
3 Date: Sun, 6 Sep 2009 17:56:20 +0200
4 Subject: [PATCH] This patch should fix bug #1365
7 bacula/src/filed/restore.c | 15 +++++++--------
8 1 files changed, 7 insertions(+), 8 deletions(-)
10 diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c
11 index a4ee03a..4400e14 100644
12 --- a/bacula/src/filed/restore.c
13 +++ b/bacula/src/filed/restore.c
14 @@ -120,7 +120,7 @@ static void close_previous_stream(r_ctx &rctx);
17 static bool verify_signature(JCR *jcr, r_ctx &rctx);
18 -int32_t extract_data(JCR *jcr, r_ctx &rctx, POOLMEM *buf, int32_t buflen,
19 +int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
20 uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx);
21 bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags,
22 RESTORE_CIPHER_CTX *cipher_ctx);
23 @@ -508,8 +508,9 @@ void do_restore(JCR *jcr)
24 rctx.flags |= FO_WIN32DECOMP; /* "decompose" BackupWrite data */
27 - if (extract_data(jcr, rctx, sd->msg, sd->msglen, &rctx.fileAddr,
28 + if (extract_data(jcr, &rctx.bfd, sd->msg, sd->msglen, &rctx.fileAddr,
29 rctx.flags, &rctx.cipher_ctx) < 0) {
30 + rctx.extract = false;
34 @@ -558,8 +559,9 @@ void do_restore(JCR *jcr)
35 Dmsg0(130, "Restoring resource fork\n");
38 - if (extract_data(jcr, rctx, sd->msg, sd->msglen, &rctx.fork_addr, rctx.fork_flags,
39 + if (extract_data(jcr, &rctx.forkbfd, sd->msg, sd->msglen, &rctx.fork_addr, rctx.fork_flags,
40 &rctx.fork_cipher_ctx) < 0) {
41 + rctx.extract = false;
42 bclose(&rctx.forkbfd);
45 @@ -1069,10 +1071,9 @@ bool store_data(JCR *jcr, BFILE *bfd, char *data, const int32_t length, bool win
46 * The flags specify whether to use sparse files or compression.
47 * Return value is the number of bytes written, or -1 on errors.
49 -int32_t extract_data(JCR *jcr, r_ctx &rctx, POOLMEM *buf, int32_t buflen,
50 - uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx)
51 +int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
52 + uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx)
54 - BFILE *bfd = &rctx.bfd;
55 char *wbuf; /* write buffer */
56 uint32_t wsize; /* write size */
57 uint32_t rsize; /* read size */
58 @@ -1172,9 +1173,7 @@ int32_t extract_data(JCR *jcr, r_ctx &rctx, POOLMEM *buf, int32_t buflen,
62 - rctx.extract = false;