Changeset 171 in MondoRescue for trunk/mondo/mondo/common/libmondo-archive.c
- Timestamp:
- Dec 8, 2005, 5:20:29 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-archive.c
r168 r171 298 298 /*@ buffers ******************************************************** */ 299 299 char *command; 300 char *zipparams ;300 char *zipparams = NULL; 301 301 char *tmp, *tmp1; 302 302 … … 325 325 326 326 327 327 if (bkpinfo->compression_level > 0) { 328 328 asprintf(&tmp, "%s/do-not-compress-these", g_mondo_home); 329 329 // -b %ld, TAPE_BLOCK_SIZE … … 333 333 asprintf(&tmp1, "%s -E %s", zipparams, tmp); 334 334 paranoid_free(zipparams) 335 335 zipparams = tmp1; 336 336 } else { 337 asprintf(&zipparams, " ");337 asprintf(&zipparams, " "); 338 338 log_msg(3, "%s not found. Cannot exclude zipfiles, etc.", tmp); 339 339 } 340 340 paranoid_free(tmp) 341 341 } else { 342 asprintf(&zipparams, " ");342 asprintf(&zipparams, " "); 343 343 } 344 344 … … 582 582 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 583 583 asprintf(&tape_size_sz, "%ld", bkpinfo->media_size[1]); 584 asprintf(&tape_device, "%s",bkpinfo->media_device);584 asprintf(&tape_device, bkpinfo->media_device); 585 585 } else { 586 asprintf(&tape_size_sz, " ");587 asprintf(&tape_device, " ");586 asprintf(&tape_size_sz, " "); 587 asprintf(&tape_device, " "); 588 588 } 589 589 if (bkpinfo->use_lzo) { … … 825 825 asprintf(&tmp, " NONBOOTABLE"); 826 826 } else { 827 asprintf(&tmp, " ");827 asprintf(&tmp, " "); 828 828 } 829 829 … … 2007 2007 "Please wait. This may take some time.", "", 2008 2008 estimated_total_noof_slices); 2009 paranoid_free(tmp); 2010 2009 2011 if (!(fin = fopen(biggielist_fname, "r"))) { 2010 2012 log_OS_error("Unable to openin biggielist"); … … 2078 2080 noof_biggie_files, use_partimagehack); 2079 2081 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2080 write_header_block_to_stream(0, 2081 calc_checksum_of_file 2082 (bigfile_fname), 2083 BLK_STOP_A_BIGGIE); 2082 tmp = calc_checksum_of_file(bigfile_fname); 2083 write_header_block_to_stream(0, tmp, BLK_STOP_A_BIGGIE); 2084 paranoid_free(tmp); 2084 2085 } 2085 2086 retval += res; … … 2090 2091 p = bigfile_fname; 2091 2092 } 2092 paranoid_free(tmp);2093 2093 if (res) { 2094 2094 asprintf(&tmp, "Archiving %s ... Failed!", bigfile_fname); … … 2772 2772 /** 2773 2773 * Make sure the user has a valid CD-R(W) in the CD drive. 2774 * @param cdrw_dev Set to the CD-R(W) device checked.2774 * @param cdrw_device Set to the CD-R(W) device checked. 2775 2775 * @param keep_looping If TRUE, keep pestering user until they insist 2776 2776 * or insert a correct CD; if FALSE, only check once. 2777 2777 * @return 0 (there was an OK CD in the drive) or 1 (there wasn't). 2778 2778 */ 2779 int 2780 interrogate_disk_currently_in_cdrw_drive(char *cdrw_dev, bool keep_looping) 2779 char *interrogate_disk_currently_in_cdrw_drive() 2781 2780 { 2782 int res = 0;2783 char *bkp;2784 2781 char *cdrecord; 2785 2786 asprintf(&bkp, "%s", cdrw_dev); 2787 if (find_cdrw_device(cdrw_dev)) { 2788 strcpy(cdrw_dev, bkp); 2789 } else { 2782 char *cdrw_device; 2783 2784 if ((cdrw_device = find_cdrw_device()) != NULL) { 2790 2785 if (!system("which cdrecord > /dev/null 2> /dev/null")) { 2791 asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_dev );2786 asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_device); 2792 2787 } else if (!system("which dvdrecord > /dev/null 2> /dev/null")) { 2793 asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_dev );2788 asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_device); 2794 2789 } else { 2795 asprintf(&cdrecord, " %s", "");2796 log_msg(2, " Oh well. I guess I'll just pray then.");2790 asprintf(&cdrecord, " "); 2791 log_msg(2, "Found no cdrecord nor dvdrecord in path."); 2797 2792 } 2798 2793 if (cdrecord[0]) { 2799 if (!keep_looping) {2800 2794 retract_CD_tray_and_defeat_autorun(); 2801 res = run_program_and_log_output(cdrecord, 5); 2802 } else { 2803 while ((res = run_program_and_log_output(cdrecord, 5))) { 2804 retract_CD_tray_and_defeat_autorun(); 2805 if (ask_me_yes_or_no 2806 ("Unable to examine CD. Are you sure this is a valid CD-R(W) CD?")) 2807 { 2808 log_msg(1, "Well, he insisted..."); 2809 break; 2810 } 2811 } 2812 } 2795 run_program_and_log_output(cdrecord, 5); 2813 2796 } 2814 2797 paranoid_free(cdrecord); 2815 2798 } 2816 paranoid_free(bkp); 2817 // retract_CD_tray_and_defeat_autorun(); 2818 return (res); 2799 return(cdrw_device); 2819 2800 } 2820 2801 … … 2834 2815 char *szmsg; 2835 2816 char *cdrom_dev; 2836 char *cdrw_dev ;2817 char *cdrw_device = NULL; 2837 2818 char *our_serial_str; 2838 2819 bool ok_go_ahead_burn_it; … … 2844 2825 char *szunmount; 2845 2826 2846 malloc_string(cdrom_dev);2847 malloc_string(cdrw_dev);2848 2849 2827 asprintf(&szmsg, "I am about to burn %s #%d", 2850 2828 media_descriptor_string(g_backup_media_type), … … 2862 2840 gotos_make_me_puke: 2863 2841 ok_go_ahead_burn_it = TRUE; 2864 if (!find_cdrom_device(cdrom_dev, FALSE)) { 2842 cdrom_dev = find_cdrom_device(FALSE); 2843 if (cdrom_dev != NULL) { 2865 2844 /* When enabled, it made CD eject-and-retract when wrong CD inserted.. Weird 2866 2845 log_msg(2, "paafcd: Retracting CD-ROM drive if possible" ); … … 2880 2859 log_to_screen("If there's a CD/DVD in the drive, it's blank."); 2881 2860 asprintf(&our_serial_str, "%s", ""); 2882 /*2883 if (interrogate_disk_currently_in_cdrw_drive(cdrw_dev, FALSE))2884 {2885 ok_go_ahead_burn_it = FALSE;2886 log_to_screen("There isn't a writable CD/DVD in the drive.");2887 }2888 else2889 {2890 log_to_screen("Confirmed. There is a blank CD/DVD in the drive.");2891 }2892 */2893 2861 } else if (!does_file_exist(szcdno) 2894 2862 || !does_file_exist(szserfname)) { … … 2938 2906 "paafcd: Can't find CD-ROM drive. Perhaps it has a blank %s in it?", 2939 2907 media_descriptor_string(g_backup_media_type)); 2940 if ( interrogate_disk_currently_in_cdrw_drive(cdrw_dev, FALSE)) {2908 if ((cdrw_device = interrogate_disk_currently_in_cdrw_drive(cdrw_device)) != NULL) { 2941 2909 ok_go_ahead_burn_it = FALSE; 2942 2910 log_to_screen("There isn't a writable %s in the drive.", 2943 2911 media_descriptor_string(g_backup_media_type)); 2944 2912 } 2913 paranoid_free(cdrw_device); 2945 2914 } 2946 2915 paranoid_free(mtpt); … … 2967 2936 log_msg(2, "paafcd: OK, going ahead and burning it."); 2968 2937 } 2938 paranoid_free(cdrom_dev); 2969 2939 2970 2940 log_msg(2, … … 2974 2944 log_to_screen("Proceeding w/ %s in drive.", 2975 2945 media_descriptor_string(g_backup_media_type)); 2976 paranoid_free(cdrom_dev);2977 paranoid_free(cdrw_dev);2978 2946 if (pmountable) { 2979 2947 if (attempt_to_mount_returned_this) { … … 3497 3465 && (bkpinfo->backup_media_type == cdr 3498 3466 || bkpinfo->backup_media_type == cdrw)) { 3499 if ( find_cdrom_device(tmp, FALSE)) // make sure find_cdrom_device() finds, records CD-R's loc3467 if ((tmp = find_cdrom_device(FALSE)) == NULL) // make sure find_cdrom_device() finds, records CD-R's loc 3500 3468 { 3501 3469 log_msg(3, "*Sigh* Mike, I hate your computer."); … … 3504 3472 else { 3505 3473 log_msg(3, "Great. Found Mike's CD-ROM drive."); 3474 paranoid_free(tmp); 3506 3475 } 3507 3476 } … … 3594 3563 "Verifying archives against live filesystem"); 3595 3564 if (bkpinfo->backup_media_type == cdstream) { 3596 strcpy(bkpinfo->media_device, "/dev/cdrom"); 3565 paranoid_alloc(bkpinfo->media_device, 3566 "/dev/cdrom"); 3597 3567 } 3598 3568 verify_tape_backups(bkpinfo); … … 3608 3578 g_current_media_number = cdno; 3609 3579 if (bkpinfo->backup_media_type != iso) { 3610 find_cdrom_device(bkpinfo->media_device, FALSE); // replace 0,0,0 with /dev/cdrom 3580 paranoid_free(bkpinfo->media_device); 3581 bkpinfo->media_device = find_cdrom_device(FALSE); 3611 3582 } 3612 3583 chdir("/"); … … 3647 3618 3648 3619 run_program_and_log_output("umount " MNT_CDROM, FALSE); 3649 // if (bkpinfo->backup_media_type != iso && !bkpinfo->please_dont_eject_when_restoring)3650 //{3651 3620 eject_device(bkpinfo->media_device); 3652 //}3653 3621 } 3654 3622 diffs = count_lines_in_file("/tmp/changed.files");
Note:
See TracChangeset
for help on using the changeset viewer.