]> git.sur5r.net Git - bacula/bacula/commitdiff
Fail job that attempts to read from closed device -- reported in bug 1885 but not...
authorKern Sibbald <kern@sibbald.com>
Sat, 9 Jun 2012 09:33:23 +0000 (11:33 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 9 Jun 2012 09:33:23 +0000 (11:33 +0200)
bacula/src/stored/block.c

index ddc7b16f3591b82d17b3cb8a206b48eeab666f81..72a9d82d95e99c4308307b7e94badeb67cf007b4 100644 (file)
@@ -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) {