Improved error message if xorriso shall open a vanished udev link

This commit is contained in:
Thomas Schmitt 2011-09-23 13:18:11 +00:00
parent 81a9d3e4dd
commit a92aa1f8a0
2 changed files with 14 additions and 7 deletions

View File

@ -48,9 +48,10 @@ static const char *un0(const char *text)
int Xorriso_auto_driveadr(struct XorrisO *xorriso, char *adr, char *result,
int flag)
{
int ret, is_known_mmc= 0;
int ret, is_known_mmc= 0, does_exist= 0;
char *path_pt, *libburn_adr= NULL;
char *abs_pt, *abs_adr= NULL;
struct stat stbuf;
Xorriso_alloc_meM(libburn_adr, char, BURN_DRIVE_ADR_LEN + SfileadrL);
Xorriso_alloc_meM(abs_adr, char, SfileadrL);
@ -77,6 +78,7 @@ int Xorriso_auto_driveadr(struct XorrisO *xorriso, char *adr, char *result,
}
is_known_mmc= burn_drive_convert_fs_adr(path_pt, libburn_adr);
does_exist= (stat(path_pt, &stbuf) != -1);
Xorriso_process_msg_queues(xorriso,0);
ret= Xorriso_is_in_patternlist(xorriso, xorriso->drive_whitelist, path_pt, 0);
@ -106,15 +108,20 @@ int Xorriso_auto_driveadr(struct XorrisO *xorriso, char *adr, char *result,
if(ret) {
strcpy(xorriso->info_text, "Drive address ");
Text_shellsafe(adr, xorriso->info_text, 1);
strcat(xorriso->info_text,
" rejected because: not MMC and -drive_class 'risky' ");
strcat(xorriso->info_text, " rejected because: ");
if(does_exist)
strcat(xorriso->info_text, "not MMC");
else
strcat(xorriso->info_text, "not existing");
strcat(xorriso->info_text, " and -drive_class 'risky' ");
Text_shellsafe(Xorriso_get_pattern(xorriso,xorriso->drive_greylist,
ret - 1, 0),
xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
Xorriso_msgs_submit(xorriso, 0,
"If the address is a legitimate target, prepend \"stdio:\"",
0, "HINT", 0);
sprintf(xorriso->info_text,
"If the address is a legitimate %s, prepend \"stdio:\"",
does_exist ? "target" : "address for a new regular file");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
{ret= 0; goto ex;}
}
}

View File

@ -1 +1 @@
#define Xorriso_timestamP "2011.09.22.142118"
#define Xorriso_timestamP "2011.09.23.131734"