From 6fa5f97da8d5a96cc08840bec10b96a96863923d Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 7 Nov 2020 12:42:16 +0100 Subject: [PATCH] Bug fix: Boot catalog could get a wrong name if cat_path= is explicitely given but not containing a slash character --- xorriso/iso_manip.c | 4 ++++ xorriso/write_run.c | 10 ++++++---- xorriso/xorriso_timestamp.h | 2 +- xorriso/xorrisoburn.h | 2 ++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/xorriso/iso_manip.c b/xorriso/iso_manip.c index 1815a8ee..4b0eb02f 100644 --- a/xorriso/iso_manip.c +++ b/xorriso/iso_manip.c @@ -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"); diff --git a/xorriso/write_run.c b/xorriso/write_run.c index 1e41f2eb..a262ce70 100644 --- a/xorriso/write_run.c +++ b/xorriso/write_run.c @@ -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; } diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index f5b54358..d0c294d1 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2020.11.03.082729" +#define Xorriso_timestamP "2020.11.07.113931" diff --git a/xorriso/xorrisoburn.h b/xorriso/xorrisoburn.h index 43ce33ac..697b2fc1 100644 --- a/xorriso/xorrisoburn.h +++ b/xorriso/xorrisoburn.h @@ -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);