Made stdio-drives work on readonly CD block devices

This commit is contained in:
Thomas Schmitt 2007-09-24 18:14:07 +00:00
parent c78403d8cf
commit 78c16e7590
3 changed files with 5 additions and 6 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.09.24.135845" #define Cdrskin_timestamP "2007.09.24.181340"

View File

@ -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 burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname)
{ {
int ret = -1, fd = -1, role = 0; 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 burn_drive *d= NULL, *regd_d;
struct stat stbuf; struct stat stbuf;
@ -1815,7 +1816,7 @@ off_t burn_disc_available_space(struct burn_drive *d,
if (d->drive_role != 1) { if (d->drive_role != 1) {
if (d->media_capacity_remaining <= 0) if (d->media_capacity_remaining <= 0)
d->media_capacity_remaining = d->media_capacity_remaining =
((off_t) (1024 * 1024 * 1024) * (off_t) 2048); ((off_t) (512 * 1024 * 1024 - 1) * (off_t) 2048);
} else { } else {
if (o != NULL) if (o != NULL)
d->send_write_parameters(d, o); d->send_write_parameters(d, o);

View File

@ -1379,7 +1379,7 @@ int burn_os_stdio_capacity(char *path, off_t *bytes)
struct statvfs vfsbuf; struct statvfs vfsbuf;
char testpath[4096], *cpt; char testpath[4096], *cpt;
long blocks; long blocks;
int open_mode = O_RDWR, fd, ret; int open_mode = O_RDONLY, fd, ret;
off_t add_size = 0; off_t add_size = 0;
testpath[0] = 0; testpath[0] = 0;
@ -1396,8 +1396,6 @@ int burn_os_stdio_capacity(char *path, off_t *bytes)
if (stat(testpath, &stbuf) == -1) if (stat(testpath, &stbuf) == -1)
return -1; return -1;
} else if(S_ISBLK(stbuf.st_mode)) { } else if(S_ISBLK(stbuf.st_mode)) {
if(burn_sg_open_o_excl)
open_mode |= O_EXCL;
fd = open(path, open_mode); fd = open(path, open_mode);
if (fd == -1) if (fd == -1)
return -2; return -2;