]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix #1624 about segfault in dvd driver when calling rewind(NULL)
authorEric Bollengier <eric@eb.homelinux.org>
Mon, 30 Aug 2010 17:01:25 +0000 (19:01 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 30 Aug 2010 17:01:25 +0000 (19:01 +0200)
bacula/src/stored/dvd.c

index 97ecf6444cde3b2d38e850141efb61c1e502d81b..dcb6a8e2d2edff9f0f3986342b84cba95adfb711 100644 (file)
@@ -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);