Better handling of not-yet-existing -cd

This commit is contained in:
2008-02-10 13:59:11 +00:00
parent 3547300e0d
commit f9ea542216
4 changed files with 30 additions and 1 deletions

View File

@ -7349,6 +7349,7 @@ int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv,
int ret, end_idx, filec= 0, nump, i;
char **filev= NULL, **patterns= NULL;
off_t mem= 0;
struct stat stbuf;
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
if(xorriso->do_iso_rr_pattern==0)
@ -7358,6 +7359,18 @@ int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv,
if((flag&2) && nump>0 ) {
;
} else if(nump <= 0) {
if(Xorriso_iso_lstat(xorriso, xorriso->wdi, &stbuf, 0)==-1) {
sprintf(xorriso->info_text,
"Current -cd path does not yet exist in the ISO image");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
{ret= 0; goto ex;}
}
if(!S_ISDIR(stbuf.st_mode)) {
sprintf(xorriso->info_text,
"Current -cd meanwhile points to a non-directory in ISO image");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
{ret= 0; goto ex;}
}
patterns= calloc(1, sizeof(char *));
if(patterns == NULL) {
no_memory:;