Got rid of assert() in sg.c by soft means
This commit is contained in:
parent
546d2f58b5
commit
08ba0e8de7
@ -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
|
0x00020109 (FATAL,HIGH) = Library not running
|
||||||
0x0002010a (FATAL,HIGH) = Unsuitable track mode
|
0x0002010a (FATAL,HIGH) = Unsuitable track mode
|
||||||
0x0002010b (FATAL,HIGH) = Burn run failed
|
0x0002010b (FATAL,HIGH) = Burn run failed
|
||||||
0x0002010c
|
0x0002010c (FATAL,HIGH) = Failed to transfer command to drive
|
||||||
0x0002010d
|
0x0002010d
|
||||||
0x0002010e
|
0x0002010e
|
||||||
0x0002010f
|
0x0002010f
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 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 <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -616,7 +618,6 @@ int sg_issue_command(struct burn_drive *d, struct command *c)
|
|||||||
int err;
|
int err;
|
||||||
sg_io_hdr_t s;
|
sg_io_hdr_t s;
|
||||||
|
|
||||||
|
|
||||||
/* ts A60821
|
/* ts A60821
|
||||||
<<< debug: for tracing calls which might use open drive fds */
|
<<< debug: for tracing calls which might use open drive fds */
|
||||||
char buf[161];
|
char buf[161];
|
||||||
@ -624,17 +625,13 @@ int sg_issue_command(struct burn_drive *d, struct command *c)
|
|||||||
d->fd,d->released);
|
d->fd,d->released);
|
||||||
mmc_function_spy(buf);
|
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;
|
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));
|
memset(&s, 0, sizeof(sg_io_hdr_t));
|
||||||
|
|
||||||
s.interface_id = 'S';
|
s.interface_id = 'S';
|
||||||
@ -663,7 +660,14 @@ this is valid during the mode probe in scan
|
|||||||
/* touch page so we can use valgrind */
|
/* touch page so we can use valgrind */
|
||||||
memset(c->page->data, 0, BUFFER_SIZE);
|
memset(c->page->data, 0, BUFFER_SIZE);
|
||||||
} else {
|
} 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;
|
s.dxfer_len = c->page->bytes;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -674,7 +678,22 @@ this is valid during the mode probe in scan
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
err = ioctl(d->fd, SG_IO, &s);
|
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 (s.sb_len_wr) {
|
||||||
if (!c->retry) {
|
if (!c->retry) {
|
||||||
c->error = 1;
|
c->error = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user