Better handling of not-yet-existing -cd

This commit is contained in:
Thomas Schmitt 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; int ret, end_idx, filec= 0, nump, i;
char **filev= NULL, **patterns= NULL; char **filev= NULL, **patterns= NULL;
off_t mem= 0; off_t mem= 0;
struct stat stbuf;
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
if(xorriso->do_iso_rr_pattern==0) 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 ) { if((flag&2) && nump>0 ) {
; ;
} else if(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 *)); patterns= calloc(1, sizeof(char *));
if(patterns == NULL) { if(patterns == NULL) {
no_memory:; no_memory:;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.02.10.130852" #define Xorriso_timestamP "2008.02.10.135822"

View File

@ -2566,6 +2566,19 @@ int Xorriso_fake_stbuf(struct XorrisO *xorriso, char *path, struct stat *stbuf,
} }
int Xorriso_iso_lstat(struct XorrisO *xorriso, char *path, struct stat *stbuf,
int flag)
{
int ret;
IsoNode *node;
ret= Xorriso_fake_stbuf(xorriso, path, stbuf, &node, 0);
if(ret>0)
return(0);
return(-1);
}
int Xorriso_sorted_dir_i(struct XorrisO *xorriso, IsoDir *dir_node, int Xorriso_sorted_dir_i(struct XorrisO *xorriso, IsoDir *dir_node,
int *filec, char ***filev, off_t boss_mem, int flag) int *filec, char ***filev, off_t boss_mem, int flag)
{ {

View File

@ -145,6 +145,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 */
int Xorriso_iso_lstat(struct XorrisO *xorriso, char *path, struct stat *stbuf,
int flag);
#endif /* Xorrisoburn_includeD */ #endif /* Xorrisoburn_includeD */