Better handling of read attempt on pseudo-drive without read-permission

This commit is contained in:
Thomas Schmitt 2011-03-24 18:21:31 +00:00
parent 9c9b82ae61
commit e86a7f9880
4 changed files with 22 additions and 6 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.03.22.085956"
#define Cdrskin_timestamP "2011.03.24.182148"

View File

@ -2998,8 +2998,13 @@ int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag);
bit0= - reserved -
bit1= do not submit error message if read error
bit2= on error do not try to read a second time
with single block steps. @since 0.5.2
with single block steps.
@since 0.5.2
bit3= return -2 on permission denied error rather than
issueing a warning message.
@since 1.0.6
@return 1=sucessful , <=0 an error occured
with bit3: -2= permission denied error
@since 0.4.0
*/
int burn_read_data(struct burn_drive *d, off_t byte_address,

View File

@ -568,6 +568,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x00020180 (FAILURE,HIGH) = Premature end of input encountered
0x00020181 (FAILURE,HIGH) = Pseudo-drive is a read-only file. Cannot write.
0x00020182 (FAILURE,HIGH) = Cannot truncate disk file for pseudo blanking
0x00020183 (WARNING,HIGH) = Failed to open device (a pseudo-drive) for reading
libdax_audioxtr:
0x00020200 (SORRY,HIGH) = Cannot open audio source file

View File

@ -423,14 +423,24 @@ int burn_read_data(struct burn_drive *d, off_t byte_address,
d->stdio_fd = fd =
open(d->devname, O_RDONLY | O_LARGEFILE);
if (fd == -1) {
if (errno != ENOENT || !(flag & 2))
if (errno == EACCES && (flag & 2)) {
if (!(flag & 8))
libdax_msgs_submit(libdax_messenger,
d->global_index, 0x00020183,
LIBDAX_MSGS_SEV_WARNING,
LIBDAX_MSGS_PRIO_HIGH,
"Failed to open device (a pseudo-drive) for reading",
errno, 0);
} else if (errno!= ENOENT || !(flag & 2))
libdax_msgs_submit(libdax_messenger,
d->global_index,
0x00020005,
d->global_index, 0x00020005,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Failed to open device (a pseudo-drive) for reading",
errno, 0);
ret = 0; goto ex;
ret = 0;
if (errno == EACCES && (flag & 8))
ret= -2;
goto ex;
}
if (lseek(fd, byte_address, SEEK_SET) == -1) {
if (!(flag & 2)) {