Got rid of assert() in sg.c by soft means
This commit is contained in:
parent
96af620334
commit
6c3f912561
@ -1 +1 @@
|
||||
#define Cdrskin_timestamP "2006.10.10.112545"
|
||||
#define Cdrskin_timestamP "2006.10.10.175444"
|
||||
|
@ -317,7 +317,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
|
||||
0x00020109 (FATAL,HIGH) = Library not running
|
||||
0x0002010a (FATAL,HIGH) = Unsuitable track mode
|
||||
0x0002010b (FATAL,HIGH) = Burn run failed
|
||||
0x0002010c
|
||||
0x0002010c (FATAL,HIGH) = Failed to transfer command to drive
|
||||
0x0002010d
|
||||
0x0002010e
|
||||
0x0002010f
|
||||
|
45
libburn/sg.c
45
libburn/sg.c
@ -1,6 +1,8 @@
|
||||
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
|
||||
|
||||
#include <assert.h>
|
||||
/* ts A61010 */
|
||||
/* #include <a ssert.h> */
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
@ -616,7 +618,6 @@ int sg_issue_command(struct burn_drive *d, struct command *c)
|
||||
int err;
|
||||
sg_io_hdr_t s;
|
||||
|
||||
|
||||
/* ts A60821
|
||||
<<< debug: for tracing calls which might use open drive fds */
|
||||
char buf[161];
|
||||
@ -624,17 +625,13 @@ int sg_issue_command(struct burn_drive *d, struct command *c)
|
||||
d->fd,d->released);
|
||||
mmc_function_spy(buf);
|
||||
|
||||
/* ts A61010 : with no fd there is no chance to send an ioctl */
|
||||
if (d->fd < 0) {
|
||||
c->error = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
c->error = 0;
|
||||
/*
|
||||
this is valid during the mode probe in scan
|
||||
if (d->fd < 1 || d->released) {
|
||||
burn_print(1,
|
||||
"command issued on ungrabbed drive, chaos.\n");
|
||||
burn_print(1, "fd = %d, released = %d\n", d->fd,
|
||||
d->released);
|
||||
}
|
||||
*/
|
||||
memset(&s, 0, sizeof(sg_io_hdr_t));
|
||||
|
||||
s.interface_id = 'S';
|
||||
@ -663,7 +660,14 @@ this is valid during the mode probe in scan
|
||||
/* touch page so we can use valgrind */
|
||||
memset(c->page->data, 0, BUFFER_SIZE);
|
||||
} else {
|
||||
assert(c->page->bytes > 0);
|
||||
|
||||
/* ts A61010 */
|
||||
/* a ssert(c->page->bytes > 0); */
|
||||
if (c->page->bytes <= 0) {
|
||||
c->error = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s.dxfer_len = c->page->bytes;
|
||||
}
|
||||
} else {
|
||||
@ -674,7 +678,22 @@ this is valid during the mode probe in scan
|
||||
|
||||
do {
|
||||
err = ioctl(d->fd, SG_IO, &s);
|
||||
assert(err != -1);
|
||||
|
||||
/* ts A61010 */
|
||||
/* a ssert(err != -1); */
|
||||
if (err == -1) {
|
||||
libdax_msgs_submit(libdax_messenger,
|
||||
d->global_index, 0x0002010c,
|
||||
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
|
||||
"Failed to transfer command to drive",
|
||||
errno, 0);
|
||||
sg_close_drive(d);
|
||||
d->released = 1;
|
||||
d->busy = BURN_DRIVE_IDLE;
|
||||
c->error = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (s.sb_len_wr) {
|
||||
if (!c->retry) {
|
||||
c->error = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user