From 43d8c72f769a7351a6c486f646d52bd975c70296 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 30 Aug 2010 18:56:40 +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