From cb0b796c3477ccfe776984abb9a0dde8cd8d0c1a Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 8 Feb 2008 17:52:43 +0000 Subject: [PATCH] Protecting volume ids from getting overwritten by predecessor --- libisoburn/trunk/xorriso/xorriso.1 | 9 ++++++--- libisoburn/trunk/xorriso/xorriso.c | 11 ++++++++++- libisoburn/trunk/xorriso/xorriso_private.h | 3 ++- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.c | 9 +++++---- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index dcec0d0c..2851b12b 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/xorriso/xorriso.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH XORRISO 1 "February 5, 2008" +.TH XORRISO 1 "February 8, 2008" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -887,8 +887,11 @@ Specifies the volume ID. The text may be up to 32 characters long. Be aware that it might get used automatically as name of the mount point when the media is inserted into a playful computer system. .br -If an ISO image gets loaded while the volume ID is set to default "ISOIMAGE", -then the volume ID of the loaded image will become the new -volid setting. +If an ISO image gets loaded while the volume ID is set to default "ISOIMAGE" +or to "", then the volume ID of the loaded image will become the effective +volume id for the next write run. But as soon as command -volid is performed +afterwards, this pending id is overridden by the new setting. +.br Consider this when setting -volid "ISOIMAGE" before executing -dev, -indev, or -rollback. If you insist in -volid "ISOIMAGE", set it again after those commands. diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index 2f4c33b1..6fbc5f74 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -2686,6 +2686,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->global_uid= 0; strcpy(m->volid, "ISOIMAGE"); m->loaded_volid[0]= 0; + m->volid_default= 1; m->do_global_gid= 0; m->global_gid= 0; m->do_global_mode= 0; @@ -3852,10 +3853,16 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); - is_default= (strcmp(xorriso->volid, "ISOIMAGE")==0); + is_default= xorriso->volid_default; sprintf(line,"-volid %s\n",Text_shellsafe(xorriso->volid,sfe,0)); if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); + if(is_default && xorriso->loaded_volid[0] && + strcmp(xorriso->loaded_volid, xorriso->volid)!=0 && !no_defaults) { + sprintf(line,"# loaded image effective -volid %s\n", + Text_shellsafe(xorriso->loaded_volid,sfe,0)); + Xorriso_status_result(xorriso,filter,fp,flag&2); + } is_default= (xorriso->do_joliet==0); sprintf(line,"-joliet %s\n", (xorriso->do_joliet == 1 ? "on" : "off")); @@ -8285,6 +8292,8 @@ int Xorriso_option_volid(struct XorrisO *xorriso, char *volid, int flag) ret= Xorriso_set_volid(xorriso, volid, 0); if(ret<=0) return(ret); + xorriso->volid_default= (strcmp(xorriso->volid, "ISOIMAGE")==0 || + xorriso->volid[0]==0); return(1); } diff --git a/libisoburn/trunk/xorriso/xorriso_private.h b/libisoburn/trunk/xorriso/xorriso_private.h index ea94aba8..64532376 100644 --- a/libisoburn/trunk/xorriso/xorriso_private.h +++ b/libisoburn/trunk/xorriso/xorriso_private.h @@ -84,7 +84,8 @@ struct XorrisO { /* the global context of xorriso */ int do_overwrite; /* 0=off, 1=on, 2=nondir */ int do_reassure; /* 0=off, 1=on, 2=tree */ - char volid[33]; + char volid[33]; + int volid_default; char loaded_volid[33]; /* >>> put libburn/isoburn aspects here */ diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 11d3424d..ec132775 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.02.08.174126" +#define Xorriso_timestamP "2008.02.08.175152" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index b29573c0..f8fb6490 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -349,9 +349,7 @@ int Xorriso_update_volid(struct XorrisO *xorriso, int flag) int gret, sret= 1; gret= Xorriso_get_volid(xorriso, xorriso->loaded_volid, 0); - if(gret>0 && strcmp(xorriso->volid, "ISOIMAGE")==0) - strcpy(xorriso->volid, xorriso->loaded_volid); - else + if(gret<=0 || (!xorriso->volid_default) || xorriso->loaded_volid[0]==0) sret= Xorriso_set_volid(xorriso, xorriso->volid, 1); return(gret>0 && sret>0); } @@ -574,7 +572,8 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) if(xorriso->loaded_volid[0]!=0) { sprintf(xorriso->result_line,"Volume id : '%s'\n",xorriso->loaded_volid); Xorriso_result(xorriso,0); - if(strcmp(xorriso->loaded_volid, xorriso->volid)!=0) { + if(strcmp(xorriso->loaded_volid, xorriso->volid)!=0 && + !xorriso->volid_default) { sprintf(xorriso->result_line, "New volume id: '%s'\n", xorriso->volid); Xorriso_result(xorriso,0); } @@ -3508,6 +3507,8 @@ int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag) int ret; IsoImage *volume; + if(xorriso->in_volset_handle == NULL) + return(2); ret= Xorriso_get_volume(xorriso, &volume, 0); if(ret<=0) return(ret);