Better behavior of update_r with no image present

This commit is contained in:
Thomas Schmitt 2008-05-10 19:43:16 +00:00
parent eeab74920f
commit 6b1eb7d79f
4 changed files with 16 additions and 9 deletions

View File

@ -4404,7 +4404,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
a[0]= 0; a[0]= 0;
ret= Xorriso_iso_lstat(xorriso, iso_adr, &s2, 0); ret= Xorriso_iso_lstat(xorriso, iso_adr, &s2, 0);
if(ret==-1) { if(ret<0) {
sprintf(respt, "? %s (ISO) : cannot find this file in ISO image\n", sprintf(respt, "? %s (ISO) : cannot find this file in ISO image\n",
Text_shellsafe(iso_adr, sfe, 0)); Text_shellsafe(iso_adr, sfe, 0));
if(!(flag&(1<<31))) if(!(flag&(1<<31)))
@ -4526,7 +4526,7 @@ int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr,
{ret= -1; goto ex;} {ret= -1; goto ex;}
} }
ret= Xorriso_iso_lstat(xorriso, part_path, &stbuf, 0); ret= Xorriso_iso_lstat(xorriso, part_path, &stbuf, 0);
if(ret==-1) if(ret<0)
continue; continue;
ret= Xorriso_compare_2_contents(xorriso, a, disk_adr, s1.st_size, ret= Xorriso_compare_2_contents(xorriso, a, disk_adr, s1.st_size,
offset, bytes, offset, bytes,
@ -6219,7 +6219,7 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
} }
if(action==15) { /* in_iso */ if(action==15) { /* in_iso */
ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0); ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0);
if(ret==-1) if(ret<0)
{ret= 1; goto ex;} {ret= 1; goto ex;}
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0)); sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
Xorriso_result(xorriso, 0); Xorriso_result(xorriso, 0);
@ -6246,7 +6246,7 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
ret= 1; ret= 1;
} else if(action==19) { /* empty_iso_dir */ } else if(action==19) { /* empty_iso_dir */
ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0); ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0);
if(ret==-1) if(ret<0)
{ret= 1; goto ex;} {ret= 1; goto ex;}
if(!S_ISDIR(stbuf.st_mode)) if(!S_ISDIR(stbuf.st_mode))
{ret= 1; goto ex;} {ret= 1; goto ex;}
@ -6258,7 +6258,7 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
} }
} else if(action==20) { /* is_full_in_iso */ } else if(action==20) { /* is_full_in_iso */
ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0); ret= Xorriso_iso_lstat(xorriso, iso_path, &stbuf, 0);
if(ret==-1) if(ret<0)
{ret= 1; goto ex;} {ret= 1; goto ex;}
if(!S_ISDIR(stbuf.st_mode)) if(!S_ISDIR(stbuf.st_mode))
{ret= 1; goto ex;} {ret= 1; goto ex;}
@ -9375,7 +9375,7 @@ int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv,
if((flag&2) && nump>0 ) { if((flag&2) && nump>0 ) {
; ;
} else if(nump <= 0) { } else if(nump <= 0) {
if(Xorriso_iso_lstat(xorriso, xorriso->wdi, &stbuf, 0)==-1) { if(Xorriso_iso_lstat(xorriso, xorriso->wdi, &stbuf, 0)<0) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Current -cd path does not yet exist in the ISO image"); "Current -cd path does not yet exist in the ISO image");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
@ -10626,13 +10626,16 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
if(flag&8) { if(flag&8) {
xorriso->find_compare_result= 1; xorriso->find_compare_result= 1;
ret= Xorriso_iso_lstat(xorriso, ipth, &stbuf, 0); ret= Xorriso_iso_lstat(xorriso, ipth, &stbuf, 0);
if(ret != -1) { if(ret >= 0) {
argv[0]= ipth; argv[0]= ipth;
argv[1]= "-exec"; argv[1]= "-exec";
argv[2]= "update"; argv[2]= "update";
argv[3]= disk_path; argv[3]= disk_path;
zero= 0; zero= 0;
ret= Xorriso_option_find(xorriso, 4, argv, &zero, 2); /* -findi */ ret= Xorriso_option_find(xorriso, 4, argv, &zero, 2); /* -findi */
} else if(ret==-2) { /* severe error (e.g. lack of image) */
ret= -1;
goto report_outcome;
} else { } else {
not_in_iso= 1; not_in_iso= 1;
ret= 1; ret= 1;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.05.09.205517" #define Xorriso_timestamP "2008.05.10.194336"

View File

@ -3462,6 +3462,8 @@ int Xorriso_iso_lstat(struct XorrisO *xorriso, char *path, struct stat *stbuf,
ret= Xorriso_fake_stbuf(xorriso, path, stbuf, &node, 0); ret= Xorriso_fake_stbuf(xorriso, path, stbuf, &node, 0);
if(ret>0) if(ret>0)
return(0); return(0);
if(ret<0)
return(-2);
return(-1); return(-1);
} }

View File

@ -158,7 +158,9 @@ int Xorriso_set_abort_severity(struct XorrisO *xorriso, int flag);
int Xorriso_report_lib_versions(struct XorrisO *xorriso, int flag); int Xorriso_report_lib_versions(struct XorrisO *xorriso, int flag);
/* @return 0= stbuf content is valid , -1 = path not found */ /* @return 0= stbuf content is valid ,
-1 = path not found , -2 = severe error occured
*/
int Xorriso_iso_lstat(struct XorrisO *xorriso, char *path, struct stat *stbuf, int Xorriso_iso_lstat(struct XorrisO *xorriso, char *path, struct stat *stbuf,
int flag); int flag);