Changeset 3866 in MondoRescue for branches/3.3/mondo/src/common/libmondo-devices.c
- Timestamp:
- Mar 7, 2024, 1:55:18 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/common/libmondo-devices.c
r3859 r3866 535 535 } 536 536 run_program_and_log_output("insmod ide-scsi", -1); 537 if ( find_home_of_exe("cdrecord")) {538 mr_asprintf(cdr_exe, "cdrecord");539 } else {540 mr_asprintf(cdr_exe, "dvdrecord");541 } 542 if ( find_home_of_exe(cdr_exe)) {537 if ((cdr_exe = find_home_of_exe("cdrecord")) == NULL) { 538 if ((cdr_exe = find_home_of_exe("wodim")) == NULL) { 539 cdr_exe = find_home_of_exe("dvdrecord"); 540 } 541 } 542 if (cdr_exe != NULL) { 543 543 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -E '[D|C][V|D]' | cut -d' ' -f2 | head -n1", cdr_exe); 544 544 tmp = call_program_and_get_last_line_of_output(command); … … 594 594 static char the_last_place_i_found_it[MAX_STR_LEN] = ""; 595 595 596 /*@ intialize *************************************************** */ 597 malloc_string(tmp); 598 malloc_string(phrase_one); 599 malloc_string(mountpoint); 600 596 assert_string_is_neither_NULL_nor_zerolength(output); 601 597 output[0] = '\0'; 602 phrase_one[0] = '\0';603 604 /*@ end vars **************************************************** */605 598 606 599 if (g_cdrom_drive_is_here[0] && !isdigit(g_cdrom_drive_is_here[0])) { 607 600 strcpy(output, g_cdrom_drive_is_here); 608 601 log_msg(3, "Been there, done that. Returning %s", output); 609 retval = 0; 610 goto end_of_find_cdrom_device; 602 return(0); 611 603 } 612 604 if (the_last_place_i_found_it[0] != '\0' && !try_to_mount) { 613 605 strcpy(output, the_last_place_i_found_it); 614 606 log_msg(3, "find_cdrom_device() --- returning last found location - '%s'", output); 615 retval = 0; 616 goto end_of_find_cdrom_device; 617 } 618 619 sprintf(mountpoint, "%s/cd.mnt", bkpinfo->tmpdir); 620 make_hole_for_dir(mountpoint); 621 622 if (find_home_of_exe("cdrecord")) { 623 mr_asprintf(cdr_exe, "cdrecord"); 624 } else { 625 mr_asprintf(cdr_exe, "dvdrecord"); 626 } 627 tmp[0] = '\0'; 628 if (!find_home_of_exe(cdr_exe)) { 607 return(0); 608 } 609 610 if ((cdr_exe = find_home_of_exe("cdrecord")) == NULL) { 611 if ((cdr_exe = find_home_of_exe("wodim")) == NULL) { 612 cdr_exe = find_home_of_exe("dvdrecord"); 613 } 614 } 615 616 if (cdr_exe == NULL) { 629 617 strcpy(output, "/dev/cdrom"); 630 618 log_msg(4, "Can't find cdrecord; assuming %s", output); 631 619 if (!does_device_exist(output)) { 632 620 log_msg(4, "That didn't work. Sorry."); 633 retval = 1; 634 goto end_of_find_cdrom_device; 621 return(1) 635 622 } else { 636 retval = 0; 637 goto end_of_find_cdrom_device; 623 return(0) 638 624 } 639 625 } … … 646 632 mr_free(cdr_exe); 647 633 mr_free(command); 648 return 634 return(1); 649 635 } 650 636 mr_free(command); 637 638 /*@ intialize *************************************************** */ 639 malloc_string(tmp); 640 malloc_string(phrase_one); 641 642 phrase_one[0] = '\0'; 643 tmp[0] = '\0'; 644 645 /*@ end vars **************************************************** */ 646 651 647 652 648 for (tmp1 = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (tmp1 != NULL); … … 810 806 #endif 811 807 808 mr_asprintf(mountpoint, "%s/cd.mnt", bkpinfo->tmpdir); 809 make_hole_for_dir(mountpoint); 810 812 811 if (found_it && try_to_mount) { 813 812 if (mount_CDROM_here(output, mountpoint)) { … … 829 828 } 830 829 unlink(mountpoint); 830 mr_free(mountpoint); 831 831 832 832 if (found_it) { … … 865 865 paranoid_free(tmp); 866 866 paranoid_free(phrase_one); 867 paranoid_free(mountpoint);868 867 return (retval); 869 868 } … … 2805 2804 2806 2805 if (ask_me_yes_or_no("Do you want to backup extended attributes?")) { 2807 if (find_home_of_exe("getfattr")) { 2808 mr_free(g_getfattr); 2809 mr_asprintf(g_getfattr,"getfattr"); 2810 } 2811 if (find_home_of_exe("getfacl")) { 2812 mr_free(g_getfacl); 2813 mr_asprintf(g_getfacl,"getfacl"); 2814 } 2806 mr_free(g_getfattr); 2807 g_getfattr = find_home_of_exe("getfattr"); 2808 mr_free(g_getfacl); 2809 g_getfacl = find_home_of_exe("getfacl"); 2815 2810 log_it("Backup of extended attributes"); 2816 2811 }
Note:
See TracChangeset
for help on using the changeset viewer.