From 310f16f3fa818bf190874233e4158c0a1f9b7413 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 14 Jan 2010 16:06:17 +0000 Subject: [PATCH] Provisory rejection of FreeBSD ATAPI drives in sg-libcdio --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/sg-libcdio.c | 25 +++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 094c03b2..2d502b47 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2010.01.14.160633" +#define Cdrskin_timestamP "2010.01.14.160748" diff --git a/libburn/trunk/libburn/sg-libcdio.c b/libburn/trunk/libburn/sg-libcdio.c index 6b784b2f..dc1676d7 100644 --- a/libburn/trunk/libburn/sg-libcdio.c +++ b/libburn/trunk/libburn/sg-libcdio.c @@ -104,6 +104,14 @@ Send feedback to libburn-hackers@pykix.org . #include #endif +#ifdef __FreeBSD__ +/* To avoid ATAPI devices */ +#define Libburn_guess_freebsd_atapi_devicE 1 +#endif +#ifdef __FreeBSD_kernel__ +#define Libburn_guess_freebsd_atapi_devicE 1 +#endif + #include #include #include @@ -202,10 +210,23 @@ static int sg_give_next_adr_raw(burn_drive_enumerator_t *idx, cdio_free_device_list(idx->ppsz_cd_drives); idx->ppsz_cd_drives = NULL; } + +#ifdef Libburn_guess_freebsd_atapi_devicE +try_next:; +#endif + if (idx->pos == NULL) return 0; if (*(idx->pos) == NULL) return 0; + +#ifdef Libburn_guess_freebsd_atapi_devicE + if (strncmp(*(idx->pos), "/dev/acd", 8) == 0) { + (idx->pos)++; + goto try_next; + } +#endif + if (strlen(*(idx->pos)) >= adr_size) return -1; strcpy(adr, *(idx->pos)); @@ -451,7 +472,7 @@ int sg_grab(struct burn_drive *d) } if (d->libcdio_name[0] == 0) /* just to be sure it is initialized */ strcpy(d->libcdio_name, d->devname); - am_wanted = burn_sg_open_o_excl ? "MMC_RDWR_EXCL" : "MMC_RDWR"; + am_wanted = (burn_sg_open_o_excl & 63) ? "MMC_RDWR_EXCL" : "MMC_RDWR"; try_to_open:; p_cdio = cdio_open_am(d->libcdio_name, DRIVER_DEVICE, am_wanted); if (p_cdio == NULL) { @@ -467,7 +488,7 @@ try_to_open:; if (strncmp(am_eff, "MMC_RDWR", 8) != 0) { cdio_destroy(p_cdio); if (!second_try) { - am_wanted = burn_sg_open_o_excl ? + am_wanted = (burn_sg_open_o_excl & 63) ? "MMC_RDWR" : "MMC_RDWR_EXCL"; second_try = 1; goto try_to_open;