]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/dvd.c
Fix #1624 about segfault in dvd driver when calling rewind(NULL)
[bacula/bacula] / bacula / src / stored / dvd.c
index 8dd31472063da85f469e652ea70b47b98593ec50..dcb6a8e2d2edff9f0f3986342b84cba95adfb711 100644 (file)
@@ -6,7 +6,7 @@
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -430,9 +430,14 @@ static bool dvd_open_first_part(DCR *dcr, int mode)
  */
 boffset_t lseek_dvd(DCR *dcr, boffset_t offset, int whence)
 {
-   DEVICE *dev = dcr->dev;
+   DEVICE *dev;
    boffset_t pos;
    char ed1[50], ed2[50];
+
+   if (!dcr) {                  /* can be NULL when called from rewind(NULL) */
+      return -1;
+   }
+   dev = dcr->dev;
    
    Dmsg5(400, "Enter lseek_dvd fd=%d off=%s w=%d part=%d nparts=%d\n", dev->fd(),
       edit_int64(offset, ed1), whence, dev->part, dev->num_dvd_parts);