Corrected behavior around image data read error

This commit is contained in:
Thomas Schmitt 2008-04-09 11:48:14 +00:00
parent ad29faa0d1
commit c723feda55
3 changed files with 35 additions and 15 deletions

View File

@ -3881,6 +3881,7 @@ much_too_long:;
@param flag bit0= mtimes of both file objects are equal
bit29= do not issue pacifier messages
bit31= do not issue result messages
@return >0 ok , <=0 error
*/
int Xorriso_compare_2_contents(struct XorrisO *xorriso, char *common_adr,
char *disk_adr, off_t disk_size,
@ -3888,7 +3889,7 @@ int Xorriso_compare_2_contents(struct XorrisO *xorriso, char *common_adr,
char *iso_adr, off_t iso_size,
int *result, int flag)
{
int fd1= -1, ret, r1, r2, done, wanted, i;
int fd1= -1, ret, r1, r2, done, wanted, i, was_error= 0;
void *stream2= NULL;
off_t r1count= 0, r2count= 0, diffcount= 0, first_diff= -1;
char *respt, buf1[32*1024], buf2[32*1024], offset_text[80];
@ -3952,6 +3953,9 @@ cannot_address:;
else
r2= 0;
if(r1<0 || r2<0)
was_error= 1;
if(r1<=0 && r2<=0)
break;
if(r1<=0) {
@ -4024,6 +4028,8 @@ cannot_address:;
if(fd1!=-1)
close(fd1);
Xorriso_iso_file_close(xorriso, &stream2, 0);
if(was_error)
return(-1);
return(1);
}
@ -4064,7 +4070,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
int *result, int flag)
{
struct stat s1, s2, stbuf;
int ret, missing= 0, is_split= 0, i;
int ret, missing= 0, is_split= 0, i, was_error= 0;
char *respt;
char a[5*SfileadrL], sfe[5*SfileadrL];
char ttx1[40], ttx2[40];
@ -4228,6 +4234,8 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
offset, bytes,
part_path, stbuf.st_size, result,
(s1.st_mtime==s2.st_mtime) | (flag&((1<<29)|(1<<31))));
if(ret<0)
was_error= 1;
}
if(total_parts>0 && split_count!=total_parts) {
sprintf(xorriso->info_text,
@ -4242,10 +4250,14 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
(off_t) 0, s1.st_size,
iso_adr, s2.st_size, result,
(s1.st_mtime==s2.st_mtime) | (flag&((1<<29)|(1<<31))));
if(ret<0)
was_error= 1;
}
}
if(was_error)
ret= -1;
else
ret= (((*result)&~((1<<17)|(1<<18)))==0);
ex:;
if(split_parts!=NULL)
@ -4291,7 +4303,10 @@ int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter,
if(ret<xorriso->find_compare_result)
xorriso->find_compare_result= ret;
if(flag&1) {
if(ret==0) {
if(ret<=0) {
if(ret<0)
if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)
return(ret);
uret= Xorriso_update_interpreter(xorriso, boss_iter, result,
disk_path, iso_path, (flag&2)<<1);
if(uret<=0)

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.04.08.153508"
#define Xorriso_timestamP "2008.04.09.114815"

View File

@ -365,6 +365,7 @@ int Xorriso__text_to_sev(char *severity_name, int *severity_number, int flag)
/* @param flag bit0= report libisofs error text
bit1= victim is disk_path
bit2= do not inquire libisofs, report msg_text and min_severity
*/
int Xorriso_report_iso_error(struct XorrisO *xorriso, char *victim,
int iso_error_code, char msg_text[], int os_errno,
@ -378,21 +379,25 @@ int Xorriso_report_iso_error(struct XorrisO *xorriso, char *victim,
if(sorry_sev<0)
Xorriso__text_to_sev("SORRY", &sorry_sev, 0);
if(flag&4) {
error_code= 0x00050000;
Xorriso__text_to_sev(min_severity, &iso_sev, 0);
} else {
error_code= iso_error_get_code(iso_error_code);
if(error_code < 0x00030000 || error_code >= 0x00040000)
error_code= (error_code & 0xffff) | 0x00050000;
if(flag&1)
msg_text_pt= (char *) iso_error_to_msg(iso_error_code);
iso_sev= iso_error_get_severity(iso_error_code);
}
if(msg_text_pt==NULL)
msg_text_pt= msg_text;
iso_sev= iso_error_get_severity(iso_error_code);
if(iso_sev >= sorry_sev && (flag & 2) && victim[0])
Xorriso_msgs_submit(xorriso, 0, victim, 0, "ERRFILE", 0);
sev_text_pt= min_severity;
Xorriso__text_to_sev(min_severity, &min_sev, 0);
if(min_sev < iso_sev)
if(min_sev < iso_sev && !(flag&4))
Xorriso__sev_to_text(iso_sev, &sev_text_pt, 0);
strcpy(sfe, msg_text_pt);
if(victim[0]) {
@ -4781,7 +4786,7 @@ int Xorriso_iso_file_read(struct XorrisO *xorriso, void *stream, char *buf,
if(ret<0) { /* error */
Xorriso_process_msg_queues(xorriso,0);
Xorriso_report_iso_error(xorriso, "", ret, "Error on read",
0, "FAILURE",1);
0, "FAILURE", 1 | ((ret == -1)<<2) );
return(-1);
}
rcnt+= ret;