--- /dev/null
+>From f182fe49fca2b2e3009f26fbf6197f8c046835ad Mon Sep 17 00:00:00 2001
+From: Marco van Wieringen <mvw@planets.elm.net>
+Date: Sun, 6 Sep 2009 17:56:20 +0200
+Subject: [PATCH] This patch should fix bug #1365
+
+---
+ bacula/src/filed/restore.c | 15 +++++++--------
+ 1 files changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c
+index a4ee03a..4400e14 100644
+--- a/bacula/src/filed/restore.c
++++ b/bacula/src/filed/restore.c
+@@ -120,7 +120,7 @@ static void close_previous_stream(r_ctx &rctx);
+
+
+ static bool verify_signature(JCR *jcr, r_ctx &rctx);
+-int32_t extract_data(JCR *jcr, r_ctx &rctx, POOLMEM *buf, int32_t buflen,
++int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
+ uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx);
+ bool flush_cipher(JCR *jcr, BFILE *bfd, uint64_t *addr, int flags,
+ RESTORE_CIPHER_CTX *cipher_ctx);
+@@ -508,8 +508,9 @@ void do_restore(JCR *jcr)
+ rctx.flags |= FO_WIN32DECOMP; /* "decompose" BackupWrite data */
+ }
+
+- if (extract_data(jcr, rctx, sd->msg, sd->msglen, &rctx.fileAddr,
++ if (extract_data(jcr, &rctx.bfd, sd->msg, sd->msglen, &rctx.fileAddr,
+ rctx.flags, &rctx.cipher_ctx) < 0) {
++ rctx.extract = false;
+ bclose(&rctx.bfd);
+ continue;
+ }
+@@ -558,8 +559,9 @@ void do_restore(JCR *jcr)
+ Dmsg0(130, "Restoring resource fork\n");
+ }
+
+- if (extract_data(jcr, rctx, sd->msg, sd->msglen, &rctx.fork_addr, rctx.fork_flags,
++ if (extract_data(jcr, &rctx.forkbfd, sd->msg, sd->msglen, &rctx.fork_addr, rctx.fork_flags,
+ &rctx.fork_cipher_ctx) < 0) {
++ rctx.extract = false;
+ bclose(&rctx.forkbfd);
+ continue;
+ }
+@@ -1069,10 +1071,9 @@ bool store_data(JCR *jcr, BFILE *bfd, char *data, const int32_t length, bool win
+ * The flags specify whether to use sparse files or compression.
+ * Return value is the number of bytes written, or -1 on errors.
+ */
+-int32_t extract_data(JCR *jcr, r_ctx &rctx, POOLMEM *buf, int32_t buflen,
+- uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx)
++int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen,
++ uint64_t *addr, int flags, RESTORE_CIPHER_CTX *cipher_ctx)
+ {
+- BFILE *bfd = &rctx.bfd;
+ char *wbuf; /* write buffer */
+ uint32_t wsize; /* write size */
+ uint32_t rsize; /* read size */
+@@ -1172,9 +1173,7 @@ int32_t extract_data(JCR *jcr, r_ctx &rctx, POOLMEM *buf, int32_t buflen,
+ return wsize;
+
+ bail_out:
+- rctx.extract = false;
+ return -1;
+-
+ }
+
+
+--
+1.5.6.5
+
--- /dev/null
+>From 297ec720cf512a6b5045c962bfb8a2f134ac77b0 Mon Sep 17 00:00:00 2001
+From: Marco van Wieringen <mvw@planets.elm.net>
+Date: Sun, 6 Sep 2009 18:06:48 +0200
+Subject: [PATCH] This patch should fix bug #1366
+
+---
+ bacula/src/filed/restore.c | 11 ++++++++++-
+ 1 files changed, 10 insertions(+), 1 deletions(-)
+
+diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c
+index 4400e14..cbb0889 100644
+--- a/bacula/src/filed/restore.c
++++ b/bacula/src/filed/restore.c
+@@ -367,7 +367,6 @@ void do_restore(JCR *jcr)
+ rctx.extract = true;
+ /* FALLTHROUGH */
+ case CF_CREATED: /* File created, but there is no content */
+- jcr->JobFiles++;
+ rctx.fileAddr = 0;
+ print_ls_output(jcr, attr);
+
+@@ -377,7 +376,17 @@ void do_restore(JCR *jcr)
+ if (attr->type == FT_REG && rsrc_len > 0) {
+ rctx.extract = true;
+ }
++
++ /*
++ * Count the resource forks not as regular files being restored.
++ */
++ if (rsrc_len == 0) {
++ jcr->JobFiles++;
++ }
++ } else {
++ jcr->JobFiles++;
+ }
++
+ if (!rctx.extract) {
+ /* set attributes now because file will not be extracted */
+ if (jcr->plugin) {
+--
+1.5.6.5
+