I have a program that formats USB drives upon insertion. It creates a thread for each drive that's inserted and can have multiple drives formatting at any time.
If a drive is removed or an error occurs libparted causes the whole program aborts with a backtrace(3) How can I tell libparted to have the libparted routine just return with an error rather than aborting the program. I can setup the exception handler but no matter what I return it still aborts (and I can't find out what thread called the exception). Any help appreciated ! char sSCSIDevice[] = "/dev/sdc"; //eg only PedExceptionOption libpartedExceptionHandler(); ped_exception_set_handler( libpartedExceptionHandler ); bWriteError = TRUE; #define VAL(x) { if( (x)==0 ) goto PartedError; } VAL( Device = ped_device_get( sSCSIDevice ) ) VAL( Disk = ped_disk_new_fresh( Device, ped_disk_type_get("msdos") ) ) VAL( FStype = ped_file_system_type_get("fat32") ) VAL( Partition = ped_partition_new( Disk, PED_PARTITION_NORMAL, FStype, 1, Device->length-1 ) ) VAL( rtn = ped_disk_add_partition( Disk, Partition, ped_constraint_new_from_max( &Partition->geom ) ) ) VAL( FS = ped_file_system_create( &Partition->geom, FStype, NULL ) ) VAL( rtn = ped_disk_commit_to_dev( Disk ) ) VAL( rtn = ped_disk_commit_to_os( Disk ) ) bWriteError = FALSE; PartedError: ped_disk_destroy(Disk); ped_device_close( Device ); if( bWriteError ) goto WriteExit;
_______________________________________________ bug-parted mailing list bug-parted@gnu.org https://lists.gnu.org/mailman/listinfo/bug-parted