Implemented option -eject

This commit is contained in:
2007-10-19 17:35:20 +00:00
parent 12e5fbb1f2
commit 8495cefa52
4 changed files with 39 additions and 24 deletions

View File

@ -113,7 +113,7 @@ int Xorriso_get_drive_handles(struct XorrisO *xorriso,
return(0);
}
*drive= (*dinfo)[0].drive;
return(1);
return((*drive)!=NULL);
}
@ -196,6 +196,7 @@ ex:
/* @param flag bit0=input drive
bit1=output drive
bit2=eject
*/
int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
{
@ -208,14 +209,16 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
if((flag&1) && xorriso->in_drive_handle != NULL) {
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to give drive up", 0);
isoburn_drive_release(drive,0);
if(drive!=NULL)
isoburn_drive_release(drive,!!(flag&4));
if(xorriso->in_volset_handle!=NULL)
iso_volset_free((struct iso_volset *) xorriso->in_volset_handle);
xorriso->in_volset_handle= NULL;
xorriso->volset_change_pending= 0;
burn_drive_info_free(dinfo);
if(dinfo!=NULL)
burn_drive_info_free(dinfo);
xorriso->in_drive_handle= NULL;
xorriso->indev[0]= 0;
if(in_is_out_too) {
@ -226,8 +229,10 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
if((flag&2) && xorriso->out_drive_handle!=NULL) {
Xorriso_get_drive_handles(xorriso, &dinfo, &drive,
"on attempt to give drive up", 2);
isoburn_drive_release(drive,0);
burn_drive_info_free(dinfo);
if(drive!=NULL)
isoburn_drive_release(drive,!!(flag&4));
if(dinfo!=NULL)
burn_drive_info_free(dinfo);
xorriso->out_drive_handle= NULL;
}
Xorriso_process_msg_queues(xorriso,0);