From 78c16e759018b348c44c2b6b652ef6054523dbd6 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 24 Sep 2007 18:14:07 +0000 Subject: [PATCH] Made stdio-drives work on readonly CD block devices --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/drive.c | 5 +++-- libburn/sg-linux.c | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 99415df..3243f99 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2007.09.24.135845" +#define Cdrskin_timestamP "2007.09.24.181340" diff --git a/libburn/drive.c b/libburn/drive.c index ecaad47..dfe83ee 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -1140,7 +1140,8 @@ int burn_drive__fd_from_special_adr(char *adr) int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname) { int ret = -1, fd = -1, role = 0; - off_t size = ((off_t) (1024 * 1024 * 1024) * (off_t) 2048); + /* divided by 512 it needs to fit into a signed long integer */ + off_t size = ((off_t) (512 * 1024 * 1024 - 1) * (off_t) 2048); struct burn_drive *d= NULL, *regd_d; struct stat stbuf; @@ -1815,7 +1816,7 @@ off_t burn_disc_available_space(struct burn_drive *d, if (d->drive_role != 1) { if (d->media_capacity_remaining <= 0) d->media_capacity_remaining = - ((off_t) (1024 * 1024 * 1024) * (off_t) 2048); + ((off_t) (512 * 1024 * 1024 - 1) * (off_t) 2048); } else { if (o != NULL) d->send_write_parameters(d, o); diff --git a/libburn/sg-linux.c b/libburn/sg-linux.c index b0a2c72..679dbcc 100644 --- a/libburn/sg-linux.c +++ b/libburn/sg-linux.c @@ -1379,7 +1379,7 @@ int burn_os_stdio_capacity(char *path, off_t *bytes) struct statvfs vfsbuf; char testpath[4096], *cpt; long blocks; - int open_mode = O_RDWR, fd, ret; + int open_mode = O_RDONLY, fd, ret; off_t add_size = 0; testpath[0] = 0; @@ -1396,8 +1396,6 @@ int burn_os_stdio_capacity(char *path, off_t *bytes) if (stat(testpath, &stbuf) == -1) return -1; } else if(S_ISBLK(stbuf.st_mode)) { - if(burn_sg_open_o_excl) - open_mode |= O_EXCL; fd = open(path, open_mode); if (fd == -1) return -2;