Bug fix: Boot catalog could get a wrong name if cat_path= is explicitely given but not containing a slash character

This commit is contained in:
Thomas Schmitt 2020-11-07 12:42:16 +01:00
parent 05de7ec5ee
commit 6fa5f97da8
4 changed files with 13 additions and 5 deletions

View File

@ -1629,6 +1629,8 @@ int Xorriso_overwrite_dest(struct XorrisO *xorriso, void *boss_iter,
/* @param boss_iter Opaque handle to be forwarded to actions in ISO image
Set to NULL if calling this function from outside ISO world
@param flag bit0= silently ignore attempt of renaming to same path
and return 2
*/
int Xorriso_rename(struct XorrisO *xorriso, void *boss_iter,
char *origin, char *dest, int flag)
@ -1679,6 +1681,8 @@ int Xorriso_rename(struct XorrisO *xorriso, void *boss_iter,
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
} else if(strcmp(eff_origin, eff_dest)==0) {
if(flag & 1)
{ret= 2; goto ex;}
sprintf(xorriso->info_text, "Ignored attempt to rename ");
Text_shellsafe(eff_origin, xorriso->info_text, 1);
strcat(xorriso->info_text, " to itself");

View File

@ -692,10 +692,12 @@ int Xorriso_attach_boot_image(struct XorrisO *xorriso, int flag)
if(xorriso->boot_image_cat_path[0] == 0) {
strcpy(xorriso->boot_image_cat_path, bin_path);
cpt= strrchr(xorriso->boot_image_cat_path, '/');
if(cpt == NULL)
cpt= xorriso->boot_image_cat_path;
else
if(cpt == NULL) {
strcpy(xorriso->boot_image_cat_path, "/");
cpt= xorriso->boot_image_cat_path + 1;
} else {
cpt++;
}
strcpy(cpt, "boot.cat");
}
ret= Xorriso_node_from_path(xorriso, image, xorriso->boot_image_cat_path,
@ -1261,7 +1263,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
if(ret > 0) {
if(strcmp(sfe, xorriso->boot_image_cat_path) != 0) {
ret= Xorriso_rename(xorriso, NULL, sfe,
xorriso->boot_image_cat_path, 0);
xorriso->boot_image_cat_path, 1);
if(ret <= 0)
goto ex;
}

View File

@ -1 +1 @@
#define Xorriso_timestamP "2020.11.03.082729"
#define Xorriso_timestamP "2020.11.07.113931"

View File

@ -172,6 +172,8 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *wd,
/* @param boss_iter Opaque handle to be forwarded to actions in ISO image
Set to NULL if calling this function from outside ISO world
@param flag bit0= silently ignore attempt of renaming to same path
and return 2
*/
int Xorriso_rename(struct XorrisO *xorriso, void *boss_iter,
char *origin, char *dest, int flag);