From 2be9f7b6d6a5bd5660d30c630283070303748951 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Thu, 7 Apr 2005 13:09:24 +0000 Subject: [PATCH] - Fix "unknown device type" problem with DVD devices. - Fix crash when there is no media in the DVD drive. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1915 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/dev.c | 2 +- bacula/src/stored/dvd.c | 5 ++--- bacula/src/stored/label.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index bad6ba545e..6ddcdf162e 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -136,7 +136,7 @@ init_dev(JCR *jcr, DEVICE *dev, DEVRES *device) tape = true; } else if (S_ISFIFO(statp.st_mode)) { fifo = true; - } else { + } else if (!(device->cap_bits & CAP_REQMOUNT)) { if (dev) { dev->dev_errno = ENODEV; } diff --git a/bacula/src/stored/dvd.c b/bacula/src/stored/dvd.c index 47a7ba2bb9..7aeae4d7e8 100644 --- a/bacula/src/stored/dvd.c +++ b/bacula/src/stored/dvd.c @@ -209,9 +209,8 @@ int open_guess_name_dev(DEVICE *dev) Dmsg1(100, "open_guess_name_dev: device cannot be mounted, but it seems to be writable, returning 0. dev=%s\n", dev->dev_name); return 0; } else { - Dmsg1(100, "open_guess_name_dev: device cannot be mounted, and is not writable, returning 0. dev=%s\n", dev->dev_name); - /* read_dev_volume_label_guess must now check dev->free_space_errno to understand that the media is not writable. */ - return 0; + Dmsg1(100, "open_guess_name_dev: device cannot be mounted, and is not writable, returning -1. dev=%s\n", dev->dev_name); + return -1; } } diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index 9ac06c2cea..9e7e762891 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -258,7 +258,7 @@ int read_dev_volume_label_guess(DCR *dcr, bool write) if (!write || dcr->VolCatInfo.VolCatParts > 0) { Mmsg2(jcr->errmsg, _("Requested Volume \"%s\" on %s is not a Bacula labeled Volume."), dev->print_name(), dcr->VolumeName); - Dmsg0(100, "Leave read_dev_volume_label_guess VOL_IO_ERROR (!open_guess_name_dev)\n"); + Dmsg0(100, "Leave read_dev_volume_label_guess VOL_NO_LABEL (!open_guess_name_dev)\n"); return VOL_NO_LABEL; } -- 2.39.5