Protecting volume ids from getting overwritten by predecessor

This commit is contained in:
Thomas Schmitt 2008-02-08 17:52:43 +00:00
parent 3e567fd6c6
commit cb0b796c34
5 changed files with 24 additions and 10 deletions

View File

@ -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.

View File

@ -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);
}

View File

@ -85,6 +85,7 @@ struct XorrisO { /* the global context of xorriso */
int do_reassure; /* 0=off, 1=on, 2=tree */
char volid[33];
int volid_default;
char loaded_volid[33];
/* >>> put libburn/isoburn aspects here */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.02.08.174126"
#define Xorriso_timestamP "2008.02.08.175152"

View File

@ -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);