From: Eric Bollengier Date: Mon, 30 Aug 2010 16:56:40 +0000 (+0200) Subject: Fix #1624 about segfault in dvd driver when calling rewind(NULL) X-Git-Url: https://git.sur5r.net/?p=bacula%2Fbacula;a=commitdiff_plain;h=43d8c72f769a7351a6c486f646d52bd975c70296 Fix #1624 about segfault in dvd driver when calling rewind(NULL) --- diff --git a/bacula/src/stored/dvd.c b/bacula/src/stored/dvd.c index 97ecf6444c..dcb6a8e2d2 100644 --- a/bacula/src/stored/dvd.c +++ b/bacula/src/stored/dvd.c @@ -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);