From 892711be6f9b60d250aea4db3ec76c627b6f4753 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 9 Jun 2012 11:33:23 +0200 Subject: [PATCH] Fail job that attempts to read from closed device -- reported in bug 1885 but not fixed --- bacula/src/stored/block.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index ddc7b16f35..72a9d82d95 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -951,7 +951,13 @@ bool DCR::read_block_from_dev(bool check_block_numbers) Dmsg1(250, "Full read in read_block_from_device() len=%d\n", block->buf_len); -// ASSERT(dev->is_open()); + if (!dev->is_open()) { + Mmsg4(dev->errmsg, _("Attempt to read closed device: fd=%d at file:blk %u:%u on device %s\n"), + dev->fd(), dev->file, dev->block_num, dev->print_name()); + Jmsg(dcr->jcr, M_FATAL, 0, "%s", dev->errmsg); + block->read_len = 0; + return false; + } reread: if (looping > 1) { -- 2.39.5