Allowed all filetypes as input, silenced debug during image read

This commit is contained in:
Thomas Schmitt 2008-01-13 22:52:53 +00:00
parent 0b37c19e3f
commit d863f670c5

View File

@ -143,19 +143,23 @@ int Xorriso_get_drive_handles(struct XorrisO *xorriso,
} }
int Xorriso_set_image_severities(struct XorrisO *xorriso, int flag) /* @param flag bit0= suppress DEBUG messages */
int Xorriso_set_image_severities(struct XorrisO *xorriso, IsoImage *volset,
int flag)
{ {
char *queue_sev, *print_sev; char *queue_sev, *print_sev;
if(xorriso->in_volset_handle==NULL) if(volset==NULL)
return(0); return(0);
if(flag&1)
queue_sev= "UPDATE";
else
queue_sev= "DEBUG"; queue_sev= "DEBUG";
if(xorriso->library_msg_direct_print) if(xorriso->library_msg_direct_print)
print_sev= xorriso->report_about_text; print_sev= xorriso->report_about_text;
else else
print_sev= "NEVER"; print_sev= "NEVER";
iso_image_set_msgs_severities((IsoImage *) xorriso->in_volset_handle, iso_image_set_msgs_severities(volset, queue_sev, print_sev, "libisofs : ");
queue_sev, print_sev, "libisofs >>> NG : ");
return(1); return(1);
} }
@ -190,7 +194,7 @@ int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag)
return(-1); return(-1);
} }
xorriso->in_volset_handle= (void *) volset; xorriso->in_volset_handle= (void *) volset;
Xorriso_set_image_severities(xorriso, 0); Xorriso_set_image_severities(xorriso, volset, 0);
xorriso->volset_change_pending= 0; xorriso->volset_change_pending= 0;
return(1); return(1);
} }
@ -208,7 +212,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
struct burn_drive_info *dinfo= NULL, *out_dinfo, *in_dinfo; struct burn_drive_info *dinfo= NULL, *out_dinfo, *in_dinfo;
struct burn_drive *drive, *out_drive, *in_drive; struct burn_drive *drive, *out_drive, *in_drive;
enum burn_disc_status state; enum burn_disc_status state;
IsoImage *volset; IsoImage *volset = NULL;
struct isoburn_read_opts ropts; struct isoburn_read_opts ropts;
if((flag&3)==0) { if((flag&3)==0) {
@ -251,6 +255,11 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
drive= dinfo[0].drive; drive= dinfo[0].drive;
state= isoburn_disc_get_status(drive); state= isoburn_disc_get_status(drive);
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
if(flag&1) {
volset= isoburn_get_attached_image(drive);
if(volset != NULL) /* The image object is already created */
Xorriso_set_image_severities(xorriso, volset, 0);
}
if(flag&2) { if(flag&2) {
xorriso->out_drive_handle= dinfo; xorriso->out_drive_handle= dinfo;
@ -309,14 +318,16 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
ropts.input_charset= NULL; ropts.input_charset= NULL;
ropts.pretend_blank= 0; ropts.pretend_blank= 0;
Xorriso_set_image_severities(xorriso, volset, 1); /* No DEBUG messages */
if(isoburn_read_image(drive, &ropts, &volset) <= 0) { if(isoburn_read_image(drive, &ropts, &volset) <= 0) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
Xorriso_set_image_severities(xorriso, volset, 0);
sprintf(xorriso->info_text,"Cannot read ISO image volset"); sprintf(xorriso->info_text,"Cannot read ISO image volset");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
ret= 3; goto ex; ret= 3; goto ex;
} }
xorriso->in_volset_handle= (void *) volset; xorriso->in_volset_handle= (void *) volset;
Xorriso_set_image_severities(xorriso, 0); Xorriso_set_image_severities(xorriso, volset, 0);
if(xorriso->out_drive_handle != NULL && if(xorriso->out_drive_handle != NULL &&
xorriso->out_drive_handle != xorriso->in_drive_handle) { xorriso->out_drive_handle != xorriso->in_drive_handle) {
@ -608,10 +619,10 @@ int Xorriso_get_volume(struct XorrisO *xorriso, IsoImage **volume,
{ {
if(xorriso->in_volset_handle==NULL) { if(xorriso->in_volset_handle==NULL) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,"No volset is loaded."); sprintf(xorriso->info_text,"No ISO image present.");
if(xorriso->indev[0]==0) if(xorriso->indev[0]==0 && xorriso->outdev[0]==0)
sprintf(xorriso->info_text+strlen(xorriso->info_text), sprintf(xorriso->info_text+strlen(xorriso->info_text),
" No -dev or -indev is selected."); " No -dev, -indev, or -outdev selected.");
else else
sprintf(xorriso->info_text+strlen(xorriso->info_text), sprintf(xorriso->info_text+strlen(xorriso->info_text),
" Possible program error with drive '%s'.", xorriso->indev); " Possible program error with drive '%s'.", xorriso->indev);
@ -923,12 +934,16 @@ cannot_lstat:;
source_is_dir= 1; source_is_dir= 1;
if(dir_dev != stbuf.st_dev && !xorriso->do_follow_mount) if(dir_dev != stbuf.st_dev && !xorriso->do_follow_mount)
do_not_dive= 1; do_not_dive= 1;
#ifdef NIX
} else if(!(S_ISREG(stbuf.st_mode) || S_ISLNK(stbuf.st_mode))) { } else if(!(S_ISREG(stbuf.st_mode) || S_ISLNK(stbuf.st_mode))) {
sprintf(xorriso->info_text,"Source file %s %s non-supported file type", sprintf(xorriso->info_text,"Source file %s %s non-supported file type",
Text_shellsafe(disk_path, sfe, 0), Text_shellsafe(disk_path, sfe, 0),
source_is_link ? "leads to" : "is of"); source_is_link ? "leads to" : "is of");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
ret= 0; goto was_problem; ret= 0; goto was_problem;
#endif /* NIX */
} }
/* does a node exist with this name ? */ /* does a node exist with this name ? */
@ -1090,14 +1105,18 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0);
return(0); return(0);
} }
if(S_ISDIR(stbuf.st_mode)) if(S_ISDIR(stbuf.st_mode)) {
is_dir= 1; is_dir= 1;
else if(!(S_ISREG(stbuf.st_mode) || S_ISLNK(stbuf.st_mode))) {
#ifdef NIX
} else if(!(S_ISREG(stbuf.st_mode) || S_ISLNK(stbuf.st_mode))) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Source file '%s' is of non-supported file type", disk_path); "Source file '%s' is of non-supported file type", disk_path);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0); return(0);
#endif /* NIX */
} else { } else {
l= strlen(img_path); l= strlen(img_path);
if(l>0) if(l>0)
@ -1136,7 +1155,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
continue; continue;
} }
source_is_dir= (is_dir || (flag&1) || !done); source_is_dir= (is_dir || (flag&1) || !done);
ret= Xorriso_node_from_path(xorriso, volume, path, &node, 0); ret= Xorriso_node_from_path(xorriso, volume, path, &node, 1);
if(ret>0) { if(ret>0) {
target_is_dir= LIBISO_ISDIR(node); target_is_dir= LIBISO_ISDIR(node);
if(!(target_is_dir && source_is_dir)) { if(!(target_is_dir && source_is_dir)) {