From fb71554fa28e81b6125c2063e028976df18334f2 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 30 Aug 2010 19:01:25 +0200 Subject: [PATCH] Fix #1624 about segfault in dvd driver when calling rewind(NULL) --- bacula/src/stored/dvd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); -- 2.39.5