From: Eric Bollengier Date: Mon, 30 Aug 2010 17:01:25 +0000 (+0200) Subject: Fix #1624 about segfault in dvd driver when calling rewind(NULL) X-Git-Tag: Release-5.2.1~1139 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c3193c757470782877afd39ff81cf15ec36c8e37;p=bacula%2Fbacula 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);