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
1 changed files with 33 additions and 14 deletions

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;
if(xorriso->in_volset_handle==NULL)
if(volset==NULL)
return(0);
queue_sev= "DEBUG";
if(flag&1)
queue_sev= "UPDATE";
else
queue_sev= "DEBUG";
if(xorriso->library_msg_direct_print)
print_sev= xorriso->report_about_text;
else
print_sev= "NEVER";
iso_image_set_msgs_severities((IsoImage *) xorriso->in_volset_handle,
queue_sev, print_sev, "libisofs >>> NG : ");
iso_image_set_msgs_severities(volset, queue_sev, print_sev, "libisofs : ");
return(1);
}
@ -190,7 +194,7 @@ int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag)
return(-1);
}
xorriso->in_volset_handle= (void *) volset;
Xorriso_set_image_severities(xorriso, 0);
Xorriso_set_image_severities(xorriso, volset, 0);
xorriso->volset_change_pending= 0;
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 *drive, *out_drive, *in_drive;
enum burn_disc_status state;
IsoImage *volset;
IsoImage *volset = NULL;
struct isoburn_read_opts ropts;
if((flag&3)==0) {
@ -251,6 +255,11 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
drive= dinfo[0].drive;
state= isoburn_disc_get_status(drive);
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) {
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.pretend_blank= 0;
Xorriso_set_image_severities(xorriso, volset, 1); /* No DEBUG messages */
if(isoburn_read_image(drive, &ropts, &volset) <= 0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_set_image_severities(xorriso, volset, 0);
sprintf(xorriso->info_text,"Cannot read ISO image volset");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
ret= 3; goto ex;
}
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 &&
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) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,"No volset is loaded.");
if(xorriso->indev[0]==0)
sprintf(xorriso->info_text,"No ISO image present.");
if(xorriso->indev[0]==0 && xorriso->outdev[0]==0)
sprintf(xorriso->info_text+strlen(xorriso->info_text),
" No -dev or -indev is selected.");
" No -dev, -indev, or -outdev selected.");
else
sprintf(xorriso->info_text+strlen(xorriso->info_text),
" Possible program error with drive '%s'.", xorriso->indev);
@ -923,12 +934,16 @@ cannot_lstat:;
source_is_dir= 1;
if(dir_dev != stbuf.st_dev && !xorriso->do_follow_mount)
do_not_dive= 1;
#ifdef NIX
} else if(!(S_ISREG(stbuf.st_mode) || S_ISLNK(stbuf.st_mode))) {
sprintf(xorriso->info_text,"Source file %s %s non-supported file type",
Text_shellsafe(disk_path, sfe, 0),
source_is_link ? "leads to" : "is of");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
ret= 0; goto was_problem;
#endif /* NIX */
}
/* 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);
return(0);
}
if(S_ISDIR(stbuf.st_mode))
if(S_ISDIR(stbuf.st_mode)) {
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);
sprintf(xorriso->info_text,
"Source file '%s' is of non-supported file type", disk_path);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
#endif /* NIX */
} else {
l= strlen(img_path);
if(l>0)
@ -1136,7 +1155,7 @@ int Xorriso_graft_in(struct XorrisO *xorriso, char *disk_path, char *img_path,
continue;
}
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) {
target_is_dir= LIBISO_ISDIR(node);
if(!(target_is_dir && source_is_dir)) {