Changeset 2324 in MondoRescue
- Timestamp:
- Aug 18, 2009, 3:13:54 PM (15 years ago)
- Location:
- branches/2.2.10/mondo/src
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2323 r2324 202 202 203 203 if (!does_file_exist(filelist)) { 204 mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", filelist); 205 log_to_screen(tmp); 206 paranoid_free(tmp); 204 log_to_screen("(archive_this_fileset) - filelist %s does not exist", filelist); 207 205 return (1); 208 206 } … … 210 208 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname); 211 209 if (system(tmp)) { 212 paranoid_free(tmp);210 mr_free(tmp); 213 211 fatal_error("Unable to write tarball to scratchdir"); 214 212 } 215 213 paranoid_free(tmp); 216 214 217 mr_asprintf(command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s", 218 filelist, fname); 215 mr_asprintf(command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s", filelist, fname); 219 216 if (bkpinfo->use_lzo) { 217 mr_free(command); 220 218 fatal_error("Can't use lzop"); 221 219 } … … 237 235 res = 0; 238 236 } 239 paranoid_free(tmp);237 mr_free(tmp); 240 238 241 239 if (res) { … … 253 251 } 254 252 } 255 paranoid_free(command);253 mr_free(command); 256 254 257 255 retval += res; … … 309 307 310 308 if (!does_file_exist(filelist)) { 311 mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", 312 filelist); 313 log_to_screen(tmp); 314 paranoid_free(tmp); 309 log_to_screen("(archive_this_fileset) - filelist %s does not exist", filelist); 315 310 return (1); 316 311 } 317 312 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname); 318 313 if (system(tmp)) { 319 paranoid_free(tmp);314 mr_free(tmp); 320 315 fatal_error("Unable to write tarball to scratchdir"); 321 316 } 322 paranoid_free(tmp);317 mr_free(tmp); 323 318 324 319 … … 326 321 mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home); 327 322 // -b %ld, TAPE_BLOCK_SIZE 328 mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe, 329 bkpinfo->compression_level); 323 mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe, bkpinfo->compression_level); 330 324 if (does_file_exist(tmp)) { 331 325 mr_strcat(zipparams, " -E %s",tmp); … … 333 327 log_msg(3, "%s not found. Cannot exclude zipfiles, etc.", tmp); 334 328 } 335 paranoid_free(tmp);329 mr_free(tmp); 336 330 } else { 337 331 mr_asprintf(zipparams, ""); … … 346 340 fatal_error("scratchdir not found"); 347 341 } 348 mr_asprintf(command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname, 349 fname, bkpinfo->zip_suffix); 342 mr_asprintf(command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname, fname, bkpinfo->zip_suffix); 350 343 paranoid_system(command); 351 paranoid_free(command);344 mr_free(command); 352 345 353 346 mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE); 354 paranoid_free(zipparams);347 mr_free(zipparams); 355 348 356 349 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname); 357 350 if (system(tmp)) { 358 paranoid_free(tmp);351 mr_free(tmp); 359 352 fatal_error("Unable to write tarball to scratchdir"); 360 353 } 361 paranoid_free(tmp);354 mr_free(tmp); 362 355 363 356 for (res = 99, tries = 0; tries < 3 && res != 0; tries++) { … … 545 538 mr_free(tmp); 546 539 547 mr_asprintf(tmp, "devs_to_exclude = '%s'", devs_to_exclude); 548 log_msg(2, tmp); 549 mr_free(tmp); 540 log_msg(2, "devs_to_exclude = '%s'", devs_to_exclude); 550 541 } 551 542 … … 557 548 mr_asprintf(tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir); 558 549 if (!does_file_exist(tmp)) { 559 fatal_error560 550 mr_free(tmp); 551 fatal_error ("Cannot find filelist.full, so I cannot count its lines"); 561 552 } 562 553 } … … 623 614 624 615 #ifdef __FreeBSD__ 625 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 626 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 616 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 627 617 if (!bootdev[0]) { 628 618 mr_free(bootdev); 629 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 630 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 619 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 631 620 } 632 621 #else 633 622 /* Linux */ 634 623 #ifdef __IA64__ 635 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 636 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 624 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 637 625 #else 638 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 639 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 626 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 640 627 #endif 641 628 if (strstr(bootdev, "/dev/cciss/")) { 642 629 mr_free(bootdev); 643 630 #ifdef __IA64__ 644 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 645 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 631 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 646 632 #else 647 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 648 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 633 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 649 634 #endif 650 635 } 651 636 if (!bootdev[0]) { 652 637 mr_free(bootdev); 653 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 654 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 638 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 655 639 if (strstr(bootdev, "/dev/cciss/")) { 656 640 mr_free(bootdev); 657 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 658 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 641 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 659 642 } 660 643 } … … 666 649 ch = 'U'; 667 650 if (bkpinfo->boot_loader != '\0') { 668 mr_asprintf(tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader); 669 log_msg(2, tmp); 670 mr_free(tmp); 651 log_msg(2, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader); 671 652 } else { 672 653 bkpinfo->boot_loader = ch; 673 654 } 674 655 if (bkpinfo->boot_device[0] != '\0') { 675 mr_asprintf(tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device); 676 log_msg(2, tmp); 677 mr_free(tmp); 656 log_msg(2, "User specified boot device. It is '%s'.", bkpinfo->boot_device); 678 657 } else { 679 658 strcpy(bkpinfo->boot_device, bootdev); … … 698 677 mr_asprintf(bootldr_str, "LILO"); 699 678 if (!does_file_exist("/etc/lilo.conf")) { 700 fatal_error 701 ("The de facto standard location for your boot loader's config file is /etc/lilo.conf but I cannot find it there. What is wrong with your Linux distribution?"); 679 fatal_error("The de facto standard location for your boot loader's config file is /etc/lilo.conf but I cannot find it there. What is wrong with your Linux distribution?"); 702 680 } 703 681 } else if (bkpinfo->boot_loader == 'G') { 704 682 mr_asprintf(bootldr_str, "GRUB"); 705 if (!does_file_exist("/boot/grub/menu.lst") 706 && does_file_exist("/boot/grub/grub.conf")) { 707 run_program_and_log_output 708 ("ln -sf /boot/grub/grub.conf /boot/grub/menu.lst", 5); 683 if (!does_file_exist("/boot/grub/menu.lst") && does_file_exist("/boot/grub/grub.conf")) { 684 run_program_and_log_output("ln -sf /boot/grub/grub.conf /boot/grub/menu.lst", 5); 709 685 } 710 686 if (!does_file_exist("/boot/grub/menu.lst")) { 711 fatal_error 712 ("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst but I cannot find it there. What is wrong with your Linux distribution?"); 687 fatal_error("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst but I cannot find it there. What is wrong with your Linux distribution?"); 713 688 } 714 689 } else if (bkpinfo->boot_loader == 'E') { 715 690 mr_asprintf(bootldr_str, "ELILO"); 716 691 /* BCO: fix it for Debian, Mandrake, ... */ 717 if (!does_file_exist("/etc/elilo.conf") 718 && does_file_exist("/boot/efi/efi/redhat/elilo.conf")) { 719 run_program_and_log_output 720 ("ln -sf /boot/efi/efi/redhat/elilo.conf /etc/elilo.conf", 721 5); 722 } 723 if (!does_file_exist("/etc/elilo.conf") 724 && does_file_exist("/boot/efi/efi/SuSE/elilo.conf")) { 725 run_program_and_log_output 726 ("ln -sf /boot/efi/efi/SuSE/elilo.conf /etc/elilo.conf", 727 5); 728 } 729 if (!does_file_exist("/etc/elilo.conf") 730 && does_file_exist("/boot/efi/efi/debian/elilo.conf")) { 731 run_program_and_log_output 732 ("ln -sf /boot/efi/efi/debian/elilo.conf /etc/elilo.conf", 733 5); 734 } 735 if (!does_file_exist("/etc/elilo.conf") 736 && does_file_exist("/boot/efi/debian/elilo.conf")) { 737 run_program_and_log_output 738 ("ln -sf /boot/efi/debian/elilo.conf /etc/elilo.conf", 739 5); 692 if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/redhat/elilo.conf")) { 693 run_program_and_log_output("ln -sf /boot/efi/efi/redhat/elilo.conf /etc/elilo.conf", 5); 694 } 695 if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/SuSE/elilo.conf")) { 696 run_program_and_log_output("ln -sf /boot/efi/efi/SuSE/elilo.conf /etc/elilo.conf", 5); 697 } 698 if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/debian/elilo.conf")) { 699 run_program_and_log_output ("ln -sf /boot/efi/efi/debian/elilo.conf /etc/elilo.conf", 5); 700 } 701 if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/debian/elilo.conf")) { 702 run_program_and_log_output ("ln -sf /boot/efi/debian/elilo.conf /etc/elilo.conf", 5); 740 703 } 741 704 if (!does_file_exist("/etc/elilo.conf")) { 742 fatal_error 743 ("The de facto mondo standard location for your boot loader's config file is /etc/elilo.conf but I cannot find it there. What is wrong with your Linux distribution? Try finding it under /boot/efi and do 'ln -s /boot/efi/..../elilo.conf /etc/elilo.conf'"); 705 fatal_error("The de facto mondo standard location for your boot loader's config file is /etc/elilo.conf but I cannot find it there. What is wrong with your Linux distribution? Try finding it under /boot/efi and do 'ln -s /boot/efi/..../elilo.conf /etc/elilo.conf'"); 744 706 } 745 707 } else if (bkpinfo->boot_loader == 'R') { … … 758 720 mr_asprintf(bootldr_str, "unknown"); 759 721 } 760 mr_asprintf(tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device); 761 log_to_screen(tmp); 762 mr_free(tmp); 722 log_to_screen("Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device); 763 723 764 724 mr_asprintf(tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir); … … 808 768 if (write_one_liner_data_file(tmp, value)) { 809 769 res++; 810 log_msg(1, "%ld: Unable to write one-liner backup-media-type", 811 __LINE__); 770 log_msg(1, "%ld: Unable to write one-liner backup-media-type", __LINE__); 812 771 } 813 772 mr_free(value); … … 817 776 if (write_one_liner_data_file(tmp, bootldr_str)) { 818 777 res++; 819 log_msg(1, "%ld: Unable to write one-liner bootloader.name", 820 __LINE__); 778 log_msg(1, "%ld: Unable to write one-liner bootloader.name", __LINE__); 821 779 } 822 780 mr_free(bootldr_str); … … 837 795 __LINE__); 838 796 } 839 paranoid_free(tmp1);797 mr_free(tmp1); 840 798 } 841 799 if (g_getfacl) { 842 800 mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir); 843 801 if (write_one_liner_data_file(tmp1, "TRUE")) { 844 log_msg(1, "%ld: Unable to write one-liner ACL", 845 __LINE__); 846 } 847 paranoid_free(tmp1); 802 log_msg(1, "%ld: Unable to write one-liner ACL", __LINE__); 803 } 804 mr_free(tmp1); 848 805 } 849 806 if (bkpinfo->use_obdr) { 850 807 mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir); 851 808 if (write_one_liner_data_file(tmp1, "TRUE")) { 852 log_msg(1, "%ld: Unable to write one-liner OBDR", 853 __LINE__); 854 } 855 paranoid_free(tmp1); 809 log_msg(1, "%ld: Unable to write one-liner OBDR", __LINE__); 810 } 811 mr_free(tmp1); 856 812 } 857 813 858 814 estimated_total_noof_slices = 859 815 size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1; 860 /* add nfs stuff here? */816 /* BERLIOS: add nfs stuff here? */ 861 817 mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir); 862 818 if (system(command)) { … … 867 823 log_msg(1, "lines_in_filelist = %ld", lines_in_filelist); 868 824 869 mr_asprintf(command,870 825 /* "mindi --custom 2=%s 3=%s/images 4=\"%s\" 5=\"%s\" \ 871 826 6=\"%s\" 7=%ld 8=\"%s\" 9=\"%s\" 10=\"%s\" \ 872 827 11=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/ 873 mr_asprintf(&command, "mindi %s --custom %s %s/images '%s' '%s' \ 874 '%s' %ld '%s' '%s' '%s' \ 828 mr_asprintf(command, "mindi %s --custom %s %s/images '%s' '%s' '%s' %ld '%s' '%s' '%s' \ 875 829 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'", tmp2, bkpinfo->tmpdir, // parameter #2 876 830 bkpinfo->scratchdir, // parameter #3 … … 923 877 log_msg(2, command); 924 878 run_program_and_log_output(command, FALSE); 925 paranoid_free(command);879 mr_free(command); 926 880 927 881 if (bkpinfo->nonbootable_backup) { 928 882 mr_asprintf(command, "cp -f %s/all.tar.gz %s/images", bkpinfo->tmpdir, bkpinfo->scratchdir); 929 883 if (system(command)) { 930 paranoid_free(command);884 mr_free(command); 931 885 fatal_error("Unable to create temporary all tarball"); 932 886 } 933 paranoid_free(command);887 mr_free(command); 934 888 } 935 889 /* For USB we already have everything on the key */ … … 937 891 mr_asprintf(command, "rm -rf %s/images", bkpinfo->scratchdir); 938 892 run_program_and_log_output(command, FALSE); 939 paranoid_free(command);893 mr_free(command); 940 894 } else { 941 895 mr_asprintf(tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir); 942 896 if (system(tmp)) { 897 mr_free(tmp); 943 898 fatal_error("Cannot find all.tar.gz in tmpdir"); 944 899 } … … 954 909 mr_asprintf(command, "grep 'Fatal error' /var/log/mindi.log"); 955 910 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 956 paranoid_free(command);911 mr_free(command); 957 912 958 913 if (strlen(tmp) > 1) { … … 1092 1047 1093 1048 if (res) { 1094 mr_asprintf(tmp, "Errors occurred while archiving set %ld. Please review logs.", archiving_set_no); 1095 log_to_screen(tmp); 1096 mr_free(tmp); 1049 log_to_screen("Errors occurred while archiving set %ld. Please review logs.", archiving_set_no); 1097 1050 } 1098 1051 if (!semaphore_p()) { … … 1470 1423 mr_free(media_usage_comment); 1471 1424 if (res) { 1472 mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", storing_set_no); 1473 log_to_screen(tmp); 1474 paranoid_free(tmp); 1475 fatal_error 1476 ("Is your hard disk full? If not, please send the author the logfile."); 1425 log_to_screen("Failed to add archive %ld's files to CD dir\n", storing_set_no); 1426 fatal_error("Is your hard disk full? If not, please send the author the logfile."); 1477 1427 } 1478 1428 storing_set_no++; … … 1504 1454 } 1505 1455 log_to_screen(tmp); 1506 paranoid_free(tmp);1456 mr_free(tmp); 1507 1457 1508 1458 paranoid_free(transfer_block); … … 1558 1508 mr_asprintf(tmp, "chmod 755 %s", bkpinfo->scratchdir); 1559 1509 run_program_and_log_output(tmp, FALSE); 1560 paranoid_free(tmp);1510 mr_free(tmp); 1561 1511 (void)chdir(bkpinfo->scratchdir); 1562 1512 … … 1571 1521 mr_asprintf(tmp, "umount %s", tmp1); 1572 1522 run_program_and_log_output(tmp, FALSE); 1573 paranoid_free(tmp);1574 } 1575 paranoid_free(tmp);1523 mr_free(tmp); 1524 } 1525 mr_free(tmp1); 1576 1526 1577 1527 log_msg(1, "Mounting USB device."); … … 1579 1529 mr_asprintf(tmp, "mkdir -p %s", tmp1); 1580 1530 run_program_and_log_output(tmp, FALSE); 1581 paranoid_free(tmp); 1531 mr_free(tmp); 1532 1582 1533 /* Mindi always create one single parition on the USB dev */ 1583 1534 mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, tmp1); 1584 1535 run_program_and_log_output(tmp, FALSE); 1585 paranoid_free(tmp);1536 mr_free(tmp); 1586 1537 1587 1538 if (bkpinfo->nonbootable_backup) { … … 1599 1550 } 1600 1551 log_to_screen(result_sz); 1601 paranoid_free(result_sz);1602 paranoid_free(tmp);1552 mr_free(result_sz); 1553 mr_free(tmp); 1603 1554 retval += res; 1604 1555 … … 1606 1557 mr_asprintf(tmp,"mkdir %s/archive", bkpinfo->scratchdir); 1607 1558 run_program_and_log_output(tmp, FALSE); 1608 paranoid_free(tmp);1559 mr_free(tmp); 1609 1560 } 1610 1561 paranoid_free(message_to_screen); … … 1614 1565 mr_asprintf(tmp, "umount %s1", bkpinfo->media_device); 1615 1566 run_program_and_log_output(tmp, FALSE); 1616 paranoid_free(tmp);1567 mr_free(tmp); 1617 1568 } 1618 1569 … … 1695 1646 if (bkpinfo->call_before_iso[0] != '\0') { 1696 1647 mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number); 1697 res = 1698 eval_call_to_make_ISO(bkpinfo->call_before_iso, 1699 destfile, g_current_media_number, 1700 MONDO_LOGFILE, message_to_screen); 1648 res = eval_call_to_make_ISO(bkpinfo->call_before_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen); 1701 1649 if (res) { 1702 1650 mr_strcat(message_to_screen, "...failed"); … … 2015 1963 log_to_screen(tmp); 2016 1964 noof_biggie_files = count_lines_in_file(biggielist_fname); 2017 open_progress_form("Backing up big files", tmp, 2018 "Please wait. This may take some time.", "", 2019 estimated_total_noof_slices); 2020 paranoid_free(tmp); 1965 open_progress_form("Backing up big files", tmp, "Please wait. This may take some time.", "", estimated_total_noof_slices); 1966 mr_free(tmp); 2021 1967 2022 1968 if (!(fin = fopen(biggielist_fname, "r"))) { … … 2127 2073 } 2128 2074 #endif 2129 paranoid_free(tmp);2075 mr_free(tmp); 2130 2076 } 2131 2077 log_msg(1, "Finished backing up bigfiles"); … … 2195 2141 retval += res; 2196 2142 if (res) { 2197 mr_asprintf(tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no); 2198 log_to_screen(tmp); 2199 mr_free(tmp); 2143 log_to_screen("Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no); 2200 2144 } 2201 2145 … … 2247 2191 2248 2192 if (res) { 2249 mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no); 2250 log_to_screen(tmp); 2251 mr_free(tmp); 2252 fatal_error 2253 ("Is your hard disk is full? If not, please send the author the logfile."); 2193 log_to_screen("Failed to add archive %ld's files to CD dir\n", curr_set_no); 2194 fatal_error("Is your hard disk is full? If not, please send the author the logfile."); 2254 2195 } 2255 2196 mr_free(curr_filelist_fname); … … 2682 2623 2683 2624 mds = media_descriptor_string(g_backup_media_type); 2684 mr_asprintf(tmp,"I am about to burn %s #%d", mds, g_current_media_number);2625 log_to_screen("I am about to burn %s #%d", mds, g_current_media_number); 2685 2626 mr_free(mds); 2686 log_to_screen(tmp);2687 mr_free(tmp);2688 2627 if (g_current_media_number < ask_for_one_if_more_than_this) { 2689 2628 return; … … 2993 2932 if (!(fin = fopen(file_to_openin, "r"))) { 2994 2933 log_OS_error("Unable to openin biggie_filename"); 2995 mr_asprintf(tmp, "Cannot archive bigfile '%s': not found", biggie_filename); 2996 log_to_screen(tmp); 2997 paranoid_free(tmp); 2934 log_to_screen("Cannot archive bigfile '%s': not found", biggie_filename); 2998 2935 2999 2936 paranoid_free(checksum_line); … … 3115 3052 retval += res; 3116 3053 if (res) { 3117 mr_asprintf(tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1); 3118 log_to_screen(tmp); 3119 paranoid_free(tmp); 3120 fatal_error 3121 ("Hard disk full. You should have bought a bigger one."); 3054 log_to_screen("Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1); 3055 fatal_error("Hard disk full. You should have bought a bigger one."); 3122 3056 } 3123 3057 } … … 3132 3066 } 3133 3067 log_msg(1, tmp); 3134 paranoid_free(tmp);3068 mr_free(tmp); 3135 3069 3136 3070 paranoid_free(checksum_line); … … 3310 3244 if (space_occupied_by_cd(bkpinfo->scratchdir) / 1024 > 3311 3245 bkpinfo->media_size[g_current_media_number]) { 3312 mr_asprintf(tmp1, "Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.", (long) space_occupied_by_cd(bkpinfo->scratchdir), (long) bkpinfo->media_size[g_current_media_number]); 3313 log_to_screen(tmp1); 3314 mr_free(tmp1); 3246 log_to_screen("Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.", (long) space_occupied_by_cd(bkpinfo->scratchdir), (long) bkpinfo->media_size[g_current_media_number]); 3315 3247 } 3316 3248 mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number); … … 3377 3309 mr_asprintf(tmp1, "rm -Rf %s/images/*gz %s/images/*data*img", bkpinfo->scratchdir, bkpinfo->scratchdir); 3378 3310 if (system(tmp1)) { 3379 log_msg 3380 (2, 3381 "Error occurred when I tried to delete the redundant IMGs and GZs"); 3311 log_msg(2, "Error occurred when I tried to delete the redundant IMGs and GZs"); 3382 3312 } 3383 3313 mr_free(tmp1); … … 3455 3385 if (res) { 3456 3386 mds = media_descriptor_string(bkpinfo->backup_media_type); 3457 mr_asprintf(tmp,"Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);3387 log_to_screen("Warnings/errors were reported while checking %s #%d", mds, g_current_media_number); 3458 3388 mr_free(mds); 3459 log_to_screen(tmp);3460 mr_free(tmp);3461 3389 3462 3390 } -
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2323 r2324 111 111 for (i = 0; i < 128; i++) { 112 112 if (flag_set[i]) { 113 mr_asprintf(tmp, "-%c %s", i, flag_val[i]); 114 log_msg(3, tmp); 115 mr_free(tmp); 113 log_msg(3, "-%c %s", i, flag_val[i]); 116 114 } 117 115 } … … 150 148 int j; 151 149 char tmp[MAX_STR_LEN], *p; 152 char *comment = NULL;153 150 154 151 assert(bkpinfo != NULL); … … 161 158 *(strchr(tmp, ',')) = '\0'; 162 159 bkpinfo->media_size[j] = friendly_sizestr_to_sizelong(tmp); 163 mr_asprintf(comment, "media_size[%d] = %ld", j, bkpinfo->media_size[j]); 164 log_msg(3, comment); 165 mr_free(comment); 160 log_msg(3, "media_size[%d] = %ld", j, bkpinfo->media_size[j]); 166 161 } 167 162 for (; j <= MAX_NOOF_MEDIA; j++) { … … 837 832 } 838 833 bkpinfo->make_filelist = FALSE; 839 mr_asprintf(p, "%s", flag_val['J']); 840 mr_free(bkpinfo->include_paths); 841 bkpinfo->include_paths = p; 834 mr_asprintf(bkpinfo->include_paths, "%s", flag_val['J']); 842 835 } 843 836 … … 878 871 log_msg(3, "flag_val['c'] = %s", flag_val['c']); 879 872 log_msg(3, "flag_val['w'] = %s", flag_val['w']); 880 //log_msg(3, "flag_set['r'] = %i", flag_set['r'] );873 // log_msg(3, "flag_set['r'] = %i", flag_set['r'] ); 881 874 if (flag_set['c']) { 882 875 bkpinfo->cdrw_speed = atoi(flag_val['c']); … … 902 895 flag_set['d'] = TRUE; 903 896 strcpy(flag_val['d'], p); 904 mr_free(p); 905 mr_asprintf(tmp1, "You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']); 906 log_to_screen(tmp1); 907 mr_free(tmp1); 897 log_to_screen("You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']); 908 898 percent = 0; 909 899 } … … 1004 994 p--; 1005 995 *p = '\0'; 1006 mr_asprintf(q,"%s",bkpinfo->nfs_mount); 1007 bkpinfo->nfs_user = q; 996 mr_asprintf(bkpinfo->nfs_user,"%s",p); 1008 997 strcpy(bkpinfo->nfs_mount,tmp); 1009 998 } 1010 999 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount); 1011 1000 mr_free(bkpinfo->isodir); 1012 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1)); 1013 bkpinfo->isodir = tmp2; 1001 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1)); 1014 1002 mr_free(tmp1); 1015 1003 … … 1025 1013 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount); 1026 1014 mr_free(bkpinfo->isodir); 1027 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1)); 1028 bkpinfo->isodir = tmp2; 1015 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1)); 1029 1016 mr_free(tmp1); 1030 1017 … … 1213 1200 && !does_file_exist(bkpinfo->kernel_path)) { 1214 1201 retval++; 1215 mr_asprintf(tmp1, "You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path); 1216 log_to_screen(tmp1); 1217 mr_free(tmp1); 1202 log_to_screen("You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path); 1218 1203 } 1219 1204 } … … 1221 1206 if (flag_set['p']) { 1222 1207 mr_free(bkpinfo->prefix); 1223 mr_asprintf(tmp1, "%s", flag_val['p']); 1224 bkpinfo->prefix = tmp1; 1208 mr_asprintf(bkpinfo->prefix, "%s", flag_val['p']); 1225 1209 log_msg(1,"Prefix forced to %s",bkpinfo->prefix); 1226 1210 } … … 1229 1213 if (flag_set['i']) { 1230 1214 mr_free(bkpinfo->isodir); 1231 mr_asprintf(tmp2, "%s", flag_val['d']); 1232 bkpinfo->isodir = tmp2; 1215 mr_asprintf(bkpinfo->isodir, "%s", flag_val['d']); 1233 1216 mr_asprintf(tmp1, "ls -l %s", bkpinfo->isodir); 1234 1217 if (run_program_and_log_output(tmp1, 2)) { … … 1256 1239 if (i) { 1257 1240 retval++; 1258 mr_asprintf(tmp2, "Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->nfs_remote_dir, bkpinfo->nfs_mount); 1259 log_to_screen(tmp2); 1260 mr_free(tmp2); 1241 log_to_screen(tmp2, "Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->nfs_remote_dir, bkpinfo->nfs_mount); 1261 1242 } 1262 1243 unlink(tmp1); … … 1297 1278 1298 1279 if (flag_set['S']) { 1299 mr_asprintf(tmp1, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768); 1300 mr_free(bkpinfo->scratchdir); 1301 bkpinfo->scratchdir = tmp1; 1280 mr_asprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768); 1302 1281 } 1303 1282 … … 1510 1489 if (flag_set[opt]) { 1511 1490 bad_switches = TRUE; 1512 mr_asprintf(tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]); 1513 log_to_screen(tmp); 1514 mr_free(tmp); 1491 log_to_screen("Switch -%c previously defined as %s\n", opt, flag_val[opt]); 1515 1492 } else { 1516 1493 flag_set[opt] = TRUE; … … 1526 1503 if (strchr(flag_val[opt], '/') 1527 1504 && flag_val[opt][0] != '/') { 1528 mr_asprintf(tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]); 1529 log_to_screen(tmp); 1530 mr_free(tmp); 1505 log_to_screen("-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]); 1531 1506 bad_switches = TRUE; 1532 1507 } … … 1539 1514 for (i = optind; i < argc; i++) { 1540 1515 bad_switches = TRUE; 1541 mr_asprintf(tmp, "Invalid arg -- %s\n", argv[i]); 1542 log_to_screen(tmp); 1543 mr_free(tmp); 1516 log_to_screen("Invalid arg -- %s\n", argv[i]); 1544 1517 } 1545 1518 return (bad_switches); … … 1615 1588 free_MR_global_filenames(); 1616 1589 1617 fatal_error 1618 ("MondoRescue is terminating in response to a signal from the OS"); 1590 fatal_error("MondoRescue is terminating in response to a signal from the OS"); 1619 1591 finish(254); // just in case 1620 1592 } … … 1629 1601 void set_signals(int on) 1630 1602 { 1631 int signals[] = 1632 { SIGTERM, SIGHUP, SIGTRAP, SIGABRT, SIGINT, SIGKILL, SIGSTOP, 0 }; 1603 int signals[] = { SIGTERM, SIGHUP, SIGTRAP, SIGABRT, SIGINT, SIGKILL, SIGSTOP, 0 }; 1633 1604 int i; 1634 1605 -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2323 r2324 108 108 { 109 109 char *tmp = NULL; 110 char *comment = NULL;111 110 bool is_this_a_ramdisk = FALSE; 112 111 113 112 mr_asprintf(tmp, "%s", where_is_root_mounted()); 114 mr_asprintf(comment, "root is currently mounted at %s\n", tmp); 115 log_msg(0, comment); 116 mr_free(comment); 113 log_msg(0, "root is currently mounted at %s\n", tmp); 117 114 118 115 #ifdef __FreeBSD__ … … 221 218 mr_asprintf(command, "cdcontrol -f %s eject", dev); 222 219 } else { 223 mr_asprintf(command, "camcontrol eject `echo %s | sed 's|/dev/||'`", 224 dev); 220 mr_asprintf(command, "camcontrol eject `echo %s | sed 's|/dev/||'`", dev); 225 221 } 226 222 #else … … 500 496 { 501 497 /*@ buffers ************************ */ 502 char *comment = NULL;503 498 char *tmp = NULL; 504 499 char *cdr_exe = NULL; … … 532 527 } else { 533 528 strcpy(cdrw_device, tmp); 534 mr_asprintf(comment, "Found CDRW device - %s", cdrw_device); 535 log_it(comment); 529 log_it("Found CDRW device - %s", cdrw_device); 536 530 strcpy(g_cdrw_drive_is_here, cdrw_device); 537 mr_free(comment);538 531 mr_free(tmp); 539 532 mr_free(cdr_exe); … … 876 869 } 877 870 878 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output 879 ("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1") 871 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1") 880 872 ); 881 873 log_msg(5, "tmp = '%s'", tmp); 882 874 if (!tmp[0]) 883 875 mr_free(tmp); 884 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output 885 ("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1") 876 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output ("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1") 886 877 ); 887 878 if (tmp[0]) { … … 1090 1081 malloc_string(incoming); 1091 1082 assert(device_raw != NULL); 1092 // assert_string_is_neither_NULL_nor_zerolength(device_raw);1093 1083 if (device_raw[0] != '/' && !strstr(device_raw, ":/")) { 1094 1084 log_msg(1, "%s needs to have a '/' prefixed - I'll do it", … … 1372 1362 log_msg(1, "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", bkpinfo->isodir, bkpinfo->tmpdir); 1373 1363 mr_free(bkpinfo->isodir); 1374 mr_asprintf(p, "%s/isodir", bkpinfo->tmpdir); 1375 bkpinfo->isodir = p; 1364 mr_asprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir); 1376 1365 } 1377 1366 } … … 1387 1376 cd_number_i_want); 1388 1377 mds = media_descriptor_string(bkpinfo->backup_media_type); 1389 mr_asprintf(tmp, "Insisting on %s #%d", mds, cd_number_i_want);1378 log_msg(3, "Insisting on %s #%d", mds, cd_number_i_want); 1390 1379 mr_asprintf(request, "Please insert %s #%d and press Enter.", mds, cd_number_i_want); 1391 1380 mr_free(mds); 1392 log_msg(3, tmp);1393 mr_free(tmp);1394 1381 1395 1382 while (what_number_cd_is_this() != cd_number_i_want) { … … 1731 1718 mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->nfs_mount); 1732 1719 mr_free(bkpinfo->isodir); 1733 mr_asprintf(p, "%s", call_program_and_get_last_line_of_output(command)); 1734 bkpinfo->isodir = p; 1720 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(command)); 1735 1721 mr_free(command); 1736 1722 … … 1772 1758 mr_free(bkpinfo->isodir); 1773 1759 if (is_this_device_mounted(bkpinfo->nfs_mount)) { 1774 mr_asprintf(p, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1")); 1775 bkpinfo->isodir = p; 1760 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1")); 1776 1761 1777 1762 } else { 1778 mr_asprintf(p, "%s/nfsdir", bkpinfo->tmpdir); 1779 bkpinfo->isodir = p; 1763 mr_asprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir); 1780 1764 mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir); 1781 1765 run_program_and_log_output(command, 5); … … 1790 1774 } 1791 1775 if (!is_this_device_mounted(bkpinfo->nfs_mount)) { 1792 popup_and_OK 1793 ("Please mount that partition before you try to backup to or restore from it."); 1776 popup_and_OK("Please mount that partition before you try to backup to or restore from it."); 1794 1777 finish(1); 1795 1778 } … … 2152 2135 fatal_error("I couldn't figure out the scratchdir!"); 2153 2136 } 2154 mr_asprintf(sz, "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));2155 2137 mr_free(bkpinfo->scratchdir); 2156 bkpinfo->scratchdir = sz;2138 mr_asprintf(bkpinfo->scratchdir , "%s/mondo.scratch.%d", tmp, (int) (random() % 32768)); 2157 2139 log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir); 2158 2140 … … 2228 2210 2229 2211 assert(bkpinfo != NULL); 2230 // log_it("Asking what_number_cd_is_this");2212 // log_it("Asking what_number_cd_is_this"); 2231 2213 if (g_ISO_restore_mode) { 2232 2214 mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'"); 2233 2234 2215 mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER"); 2235 2216 cd_number = atoi(last_line_of_file(mountdev)); 2236 paranoid_free(mountdev);2237 paranoid_free(tmp);2217 mr_free(mountdev); 2218 mr_free(tmp); 2238 2219 2239 2220 return (cd_number); … … 2242 2223 mr_asprintf(mountdev, "%s", bkpinfo->media_device); 2243 2224 if (!mountdev[0]) { 2244 log_it 2245 ("(what_number_cd_is_this) Warning - media_device unknown. Finding out..."); 2225 log_it("(what_number_cd_is_this) Warning - media_device unknown. Finding out..."); 2246 2226 find_cdrom_device(bkpinfo->media_device, FALSE); 2247 2227 } … … 2253 2233 } 2254 2234 } 2255 paranoid_free(mountdev);2235 mr_free(mountdev); 2256 2236 2257 2237 cd_number = atoi(last_line_of_file(MNT_CDROM "/archives/THIS-CD-NUMBER")); -
branches/2.2.10/mondo/src/common/libmondo-fifo.c
r2323 r2324 94 94 if (!res) { 95 95 bufsize++; 96 mr_asprintf(tmp, "Negotiated max buffer of %d MB ", bufsize); 97 log_to_screen(tmp); 98 mr_free(tmp); 96 log_to_screen(tmp, "Negotiated max buffer of %d MB ", bufsize); 99 97 } else { 100 98 bufsize = 0; -
branches/2.2.10/mondo/src/common/libmondo-filelist.c
r2323 r2324 159 159 160 160 mr_asprintf(tmp_fname, "%s/sortfile", bkpinfo->tmpdir); 161 162 161 mr_asprintf(command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE); 163 162 retval = system(command); … … 334 333 335 334 if (curr_set_no == 0) { 336 mr_asprintf(tmp, "Only one fileset. Fine.");335 log_msg(1, "Only one fileset. Fine."); 337 336 } else { 338 mr_asprintf(tmp, "Filelist divided into %ld sets", curr_set_no + 1); 339 } 340 log_msg(1, tmp); 341 mr_free(tmp); 337 log_msg(1, "Filelist divided into %ld sets", curr_set_no + 1); 338 } 342 339 close_evalcall_form(); 343 340 /* This is to work around an obscure bug in Newt; open a form, close it, … … 474 471 paranoid_free(tmp); 475 472 mr_asprintf(syscall, "%s 2>> /dev/null", strtmp); // " MONDO_LOGFILE); 476 paranoid_free(strtmp);473 mr_free(strtmp); 477 474 call_exe_and_pipe_output_to_fd(syscall, pout); 478 paranoid_free(syscall);475 mr_free(syscall); 479 476 } 480 477 paranoid_fclose(fin); … … 1416 1413 mr_asprintf(tmp, "Reading %-68s", dir); 1417 1414 newtDrawRootText(0, g_noof_rows - 3, tmp); 1418 paranoid_free(tmp);1415 mr_free(tmp); 1419 1416 } 1420 1417 #endif … … 1436 1433 mr_asprintf(tmp,"opendir %s", dir); 1437 1434 log_OS_error(tmp); 1438 paranoid_free(tmp);1435 mr_free(tmp); 1439 1436 } else if (strstr(skip_these, new_with_spaces)) { 1440 1437 fprintf(fout, "%s\n", dir); // if excluded dir then print dir ONLY … … 1452 1449 if (strstr(skip_these, new_with_spaces)) { 1453 1450 fprintf(fout, "%s\n", new); 1454 paranoid_free(new_with_spaces);1451 mr_free(new_with_spaces); 1455 1452 } else { 1456 paranoid_free(new_with_spaces);1453 mr_free(new_with_spaces); 1457 1454 if (!lstat(new, &statbuf)) { 1458 1455 if (!S_ISLNK(statbuf.st_mode) … … 1471 1468 #ifndef _XWIN 1472 1469 if (!g_text_mode) { 1473 newtDrawRootText(77, g_noof_rows - 3, 1474 tmp); 1470 newtDrawRootText(77, g_noof_rows - 3, tmp); 1475 1471 newtRefresh(); 1476 1472 } 1477 1473 #endif 1478 paranoid_free(tmp);1474 mr_free(tmp); 1479 1475 } 1480 1476 } … … 1565 1561 mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0); 1566 1562 if (!include_paths && !userdef_filelist) { 1567 fatal_error 1568 ("Please supply either include_paths or userdef_filelist"); 1563 fatal_error("Please supply either include_paths or userdef_filelist"); 1569 1564 } 1570 1565 // make hole for filelist … … 1584 1579 // backup last known good datefile just in case :) 1585 1580 if (does_file_exist(sz_datefile)) { 1586 mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile, 1587 sz_datefile); 1581 mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile, sz_datefile); 1588 1582 paranoid_system(command); 1589 1583 mr_free(command); … … 1626 1620 log_msg(2, "Found windows FS: %s",tmp2); 1627 1621 mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2); 1628 paranoid_free(tmp2);1622 mr_free(tmp2); 1629 1623 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1)); 1630 1624 log_msg(2, "Found windows files: %s",tmp2); -
branches/2.2.10/mondo/src/common/libmondo-files.c
r2323 r2324 48 48 static char output[MAX_STR_LEN]; 49 49 char *command = NULL; 50 char *tmp = NULL;51 50 52 51 /*@ pointers **************************************************** */ … … 71 70 mr_free(command); 72 71 } else { 73 mr_asprintf(tmp, "File '%s' not found; cannot calc checksum", filename); 74 log_it(tmp); 75 mr_free(tmp); 72 log_it("File '%s' not found; cannot calc checksum", filename); 76 73 } 77 74 if (p) { … … 129 126 char *command = NULL; 130 127 char incoming[MAX_STR_LEN]; 131 char *tmp = NULL;132 128 133 129 /*@ long ******************************************************** */ … … 142 138 assert_string_is_neither_NULL_nor_zerolength(filename); 143 139 if (!does_file_exist(filename)) { 144 mr_asprintf(tmp, "%s does not exist, so I cannot found the number of lines in it", filename); 145 log_it(tmp); 146 mr_free(tmp); 140 log_it("%s does not exist, so I cannot found the number of lines in it", filename); 147 141 return (0); 148 142 } … … 251 245 fprintf(fout, "%s\n", incoming); 252 246 } else { 253 mr_asprintf(tmp, "Excluding '%s'-nonexistent\n", incoming); 254 log_it(tmp); 255 mr_free(tmp); 247 log_it("Excluding '%s'-nonexistent\n", incoming); 256 248 } 257 249 } … … 354 346 } 355 347 mr_asprintf(command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming); 356 strcpy(incoming, 357 call_program_and_get_last_line_of_output(command)); 348 strcpy(incoming, call_program_and_get_last_line_of_output(command)); 358 349 mr_free(command); 359 350 } … … 361 352 { 362 353 mr_asprintf(command, "dirname %s 2> /dev/null", incoming); 363 strcpy(incoming, 364 call_program_and_get_last_line_of_output(command)); 354 strcpy(incoming, call_program_and_get_last_line_of_output(command)); 365 355 mr_free(command); 366 356 } … … 453 443 if (i < 0) { 454 444 mr_asprintf(command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%'); 455 strcpy(lastline, 456 call_program_and_get_last_line_of_output(command)); 445 strcpy(lastline, call_program_and_get_last_line_of_output(command)); 457 446 mr_free(command); 458 447 if (!lastline[0]) { … … 495 484 static char output[MAX_STR_LEN]; 496 485 char *command = NULL; 497 char *tmp = NULL;498 486 499 487 /*@ pointers **************************************************** */ … … 503 491 504 492 if (!does_file_exist(filename)) { 505 mr_asprintf(tmp, "Tring to get last line of nonexistent file (%s)", filename); 506 log_it(tmp); 507 mr_free(tmp); 493 log_it("Tring to get last line of nonexistent file (%s)", filename); 508 494 output[0] = '\0'; 509 495 return (output); … … 618 604 /* printf("%0d%% done \r",percentage); */ 619 605 } else { 620 time_remaining = 621 time_taken * 100 / (long) (percentage) - time_taken; 622 mr_asprintf(tmp, "%02d%% done %02d:%02d taken %02d:%02d remaining %-37s\r", percentage, (int) (time_taken / 60), (int) (time_taken % 60), (int) (time_remaining / 60), (int) (time_remaining % 60), curr_fname); 623 log_to_screen(tmp); 624 mr_free(tmp); 606 time_remaining = time_taken * 100 / (long) (percentage) - time_taken; 607 log_to_screen("%02d%% done %02d:%02d taken %02d:%02d remaining %-37s\r", percentage, (int) (time_taken / 60), (int) (time_taken % 60), (int) (time_remaining / 60), (int) (time_remaining % 60), curr_fname); 625 608 } 626 609 sync(); … … 820 803 log_msg(4, "%s --> %ld K", fname, file_len_K); 821 804 } 822 mr_asprintf(comment, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL); 823 log_msg(4, comment); 824 mr_free(comment); 805 log_msg(4, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL); 825 806 if (feof(fin)) { 826 807 break; … … 920 901 /*@ buffers *** */ 921 902 char *command = NULL; 922 char *errorstr = NULL;923 903 int res = 0; 924 904 … … 928 908 929 909 if (res) { 930 mr_asprintf(errorstr, "Please install '%s'. I cannot find it on your system.", fname); 931 log_to_screen(errorstr); 932 mr_free(errorstr); 910 log_to_screen("Please install '%s'. I cannot find it on your system.", fname); 933 911 log_to_screen("There may be hyperlink at http://www.mondorescue.com which"); 934 912 log_to_screen("will take you to the relevant (missing) package."); … … 1031 1009 char *command = NULL; 1032 1010 char tmp[MAX_STR_LEN]; 1033 char old_pwd[MAX_STR_LEN];1034 1011 int res = 0; 1035 1012 … … 1124 1101 p = strchr(tmp, ':'); 1125 1102 if (!p) { 1126 fatal_error 1127 ("NFS mount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs"); 1103 fatal_error("NFS mount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs"); 1128 1104 } 1129 1105 *(p++) = '\0'; … … 1229 1205 1230 1206 1231 1232 1233 1234 1235 1207 /** 1236 1208 * Determine the approximate number of media that the backup will take up, -
branches/2.2.10/mondo/src/common/libmondo-fork.c
r2323 r2324 252 252 /*@ int ********************************************************* */ 253 253 int res; 254 int i;255 254 bool log_if_failure = FALSE; 256 255 bool log_if_success = FALSE; … … 354 353 355 354 /*@ buffers **************************************************** */ 356 char *tmp = NULL;357 355 char *command = NULL; 358 356 char *lockfile = NULL; … … 367 365 mr_asprintf(command, "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res", lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile); 368 366 open_evalcall_form(what_i_am_doing); 369 mr_asprintf(tmp, "Executing %s", basic_call); 370 log_msg(2, tmp); 371 mr_free(tmp); 367 log_msg(2, "Executing %s", basic_call); 372 368 373 369 if (!(fin = popen(command, "r"))) { 374 370 log_OS_error("Unable to popen-in command"); 375 mr_asprintf(tmp, "Failed utterly to call '%s'", command); 376 log_to_screen(tmp); 377 mr_free(tmp); 371 log_to_screen("Failed utterly to call '%s'", command); 378 372 mr_free(command); 379 373 mr_free(lockfile); -
branches/2.2.10/mondo/src/common/libmondo-mountlist.c
r2323 r2324 341 341 if (amount_allocated > physical_drive_size) // Used to be +1, but what if you're 1 MB too high? 342 342 { 343 mr_asprintf(tmp, " %ld MB over-allocated on %s.", 344 amount_allocated - physical_drive_size, drive); 343 mr_asprintf(tmp, " %ld MB over-allocated on %s.", amount_allocated - physical_drive_size, drive); 345 344 log_it(tmp); 346 345 mr_strcat(flaws_str, "%s", tmp); … … 348 347 res++; 349 348 } else if (amount_allocated < physical_drive_size - 1) { /* NOT AN ERROR, JUST A WARNING :-) */ 350 mr_asprintf(tmp, " %ld MB unallocated on %s.", 351 physical_drive_size - amount_allocated, drive); 349 mr_asprintf(tmp, " %ld MB unallocated on %s.", physical_drive_size - amount_allocated, drive); 352 350 log_it(tmp); 353 351 mr_strcat(flaws_str, "%s", tmp); … … 403 401 return(flaws_str); 404 402 } else { 405 mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size); 406 log_it(tmp); 407 mr_free(tmp); 403 log_it("%s is %ld MB", drive, physical_drive_size); 408 404 } 409 405 … … 424 420 } else if (curr_part_no > 5 425 421 || (curr_part_no <= 4 && prev_part_no > 0)) { 426 mr_asprintf(tmp, " Gap on %s between %d and %d.", drive, 427 prev_part_no, curr_part_no); 422 mr_asprintf(tmp, " Gap on %s between %d and %d.", drive, prev_part_no, curr_part_no); 428 423 log_it(tmp); 429 424 mr_strcat(flaws_str, "%s", tmp); … … 496 491 /* Over-allocated the disk? Unallocated space on disk? */ 497 492 if (amount_allocated > physical_drive_size + 1) { 498 mr_asprintf(tmp, " %ld MB over-allocated on %s.", 499 amount_allocated - physical_drive_size, drive); 493 mr_asprintf(tmp, " %ld MB over-allocated on %s.", amount_allocated - physical_drive_size, drive); 500 494 log_it(tmp); 501 495 mr_strcat(flaws_str, "%s", tmp); … … 503 497 res++; 504 498 } else if (amount_allocated < physical_drive_size - 1) { /* NOT AN ERROR, JUST A WARNING :-) */ 505 mr_asprintf(tmp, " %ld MB unallocated on %s.", 506 physical_drive_size - amount_allocated, drive); 499 mr_asprintf(tmp, " %ld MB unallocated on %s.", physical_drive_size - amount_allocated, drive); 507 500 log_it(tmp); 508 501 mr_strcat(flaws_str, "%s", tmp); … … 561 554 (drivelist->el[i].device, 562 555 DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE)) { 563 mr_asprintf(tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device); 564 log_it(tmp); 565 paranoid_free(tmp); 556 log_it(" Not evaluating %s (I don't know how yet)", drivelist->el[i].device); 566 557 } else { 567 558 log_msg(8, "Evaluating drive #%d (%s) within mountlist", i, drivelist->el[i].device); … … 576 567 log_msg(8,"Adding: %s to %s", tmp, flaws_str); 577 568 mr_strcat(flaws_str, "%s", tmp); 578 paranoid_free(tmp);569 mr_free(tmp); 579 570 } 580 571 } 581 572 res += look_for_duplicate_mountpoints(mountlist, flaws_str); 582 573 res = spread_flaws_across_three_lines(flaws_str, flaws_str_A, flaws_str_B, flaws_str_C,res); 583 paranoid_free(flaws_str);574 mr_free(flaws_str); 584 575 return(res); 585 576 } … … 654 645 mr_strcat(flaws_str, "%s", tmp); 655 646 log_it(tmp); 656 paranoid_free(tmp);647 mr_free(tmp); 657 648 res++; 658 649 } 659 paranoid_free(curr_mountpoint);650 mr_free(curr_mountpoint); 660 651 } 661 652 return (res); … … 693 684 if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) { 694 685 log_msg(8, "Not putting %s in list of drives: it's a virtual drive", drive); 695 paranoid_free(drive);686 mr_free(drive); 696 687 continue; 697 688 } … … 700 691 if (size == 0) { 701 692 log_msg(8, "Not putting %s in list of drives: it has zero size (maybe an LVM volume)", drive); 702 paranoid_free(drive);693 mr_free(drive); 703 694 continue; 704 695 } … … 708 699 /* memory allocation */ 709 700 truncdrive = truncate_to_drive_name(drive); 710 paranoid_free(drive);701 mr_free(drive); 711 702 712 703 log_msg(8, "drive truncated to %s", truncdrive); … … 757 748 int used_by = 0; 758 749 759 /*@ buffers ********************************************************* */760 char *tmp = NULL;761 762 750 assert(output_list != NULL); 763 751 assert(mountlist != NULL); … … 769 757 for (i = 0; i < mountlist->entries; i++) { 770 758 if (strstr(mountlist->el[i].mountpoint, "raid")) { 771 used_by = 772 which_raid_device_is_using_this_partition(raidlist, 759 used_by = which_raid_device_is_using_this_partition(raidlist, 773 760 mountlist->el[i]. 774 761 device); … … 777 764 (void *) &mountlist->el[i], 778 765 sizeof(struct mountlist_line)); 779 mr_asprintf(tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device); 780 log_it(tmp); 781 paranoid_free(tmp); 766 log_it("%s is available; user may choose to add it to raid device", output_list->el[items - 1].device); 782 767 } 783 768 } … … 895 880 if (j < items) { 896 881 strcat(mountlist->el[items].device, "_dup"); 897 mr_asprintf(tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device); 898 log_it(tmp); 899 paranoid_free(tmp); 882 log_it("Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device); 900 883 } 901 884 mr_asprintf(tmp, "%s", mountlist->el[items].device); … … 1065 1048 1066 1049 mountlist->el[b].size = size; 1067 paranoid_free(device);1068 paranoid_free(mountpoint);1069 paranoid_free(format);1050 mr_free(device); 1051 mr_free(mountpoint); 1052 mr_free(format); 1070 1053 } 1071 1054 -
branches/2.2.10/mondo/src/common/libmondo-raid.c
r2323 r2324 471 471 { 472 472 FILE *fin; 473 char *tmp1 = NULL;474 473 int items; 475 474 … … 585 584 fclose(fin); 586 585 log_it("Raidtab loaded successfully."); 587 mr_asprintf(tmp1, "%d RAID devices in raidtab", raidlist->entries); 588 log_it(tmp1); 589 mr_free(tmp1); 586 log_it("%d RAID devices in raidtab", raidlist->entries); 590 587 return (0); 591 588 } … … 687 684 688 685 /*@ add mallocs * */ 689 char *tmp = NULL;690 686 char *labelB; 691 687 char *valueB; … … 744 740 } 745 741 if (!disklist) { 746 mr_asprintf(tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label); 747 log_it(tmp); 748 mr_free(tmp); 742 log_it("Ignoring '%s %s' pair of disk %s", labelB, valueB, label); 749 743 } else { 750 744 index = atoi(valueB); … … 1008 1002 mr_asprintf(strtmp, "%s", pos); 1009 1003 strcpy(string, strtmp); 1010 paranoid_free(strtmp);1004 mr_free(strtmp); 1011 1005 // if we have newline after only spaces, this is a blank line, update 1012 1006 // counters, otherwise do normal parsing … … 1029 1023 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1030 1024 strcpy(raidlist->el[raidlist->entries].raid_device, strtmp); 1031 paranoid_free(strtmp);1025 mr_free(strtmp); 1032 1026 mr_free(token); 1033 1027 // skip ':' and status … … 1088 1082 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1089 1083 strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp); 1090 paranoid_free(strtmp);1084 mr_free(strtmp); 1091 1085 raidlist->el[raidlist->entries].data_disks.entries++; 1092 1086 break; … … 1095 1089 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1096 1090 strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp); 1097 paranoid_free(strtmp);1091 mr_free(strtmp); 1098 1092 raidlist->el[raidlist->entries].spare_disks.entries++; 1099 1093 break; … … 1102 1096 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1103 1097 strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp); 1104 paranoid_free(strtmp);1098 mr_free(strtmp); 1105 1099 raidlist->el[raidlist->entries].failed_disks.entries++; 1106 1100 log_it("At least one failed disk found in RAID array.\n"); -
branches/2.2.10/mondo/src/common/libmondo-stream.c
r2323 r2324 1012 1012 { 1013 1013 /*@ buffers ***************************************************** */ 1014 char *tmp = NULL;1015 1014 char *datablock; 1016 1015 char *temp_fname; 1017 1016 char *temp_cksum; 1018 1017 char *actual_cksum = NULL; 1019 // char *pA, *pB;1020 1018 1021 1019 /*@ int ********************************************************* */ … … 1058 1056 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1059 1057 if (orig_size != temp_size && orig_size != -1) { 1060 mr_asprintf(tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10); 1061 log_to_screen(tmp); 1062 mr_free(tmp); 1058 log_to_screen("output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10); 1063 1059 } 1064 1060 if (ctrl_chr != BLK_START_FILE) { … … 1131 1127 } 1132 1128 if (strcmp(temp_cksum, actual_cksum)) { 1133 mr_asprintf(tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum); 1134 log_to_screen(tmp); 1135 mr_free(tmp); 1136 1137 mr_asprintf(tmp, "%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10); 1138 log_to_screen(tmp); 1139 mr_free(tmp); 1140 1129 log_to_screen("actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum); 1130 log_to_screen("%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10); 1141 1131 retval++; 1142 1132 } … … 1573 1563 /*@ pointers *************************************************** */ 1574 1564 FILE *fin; 1575 char *tmp = NULL;1576 1565 1577 1566 /*@ long ******************************************************* */ … … 1591 1580 log_it("Data disks = %s", fname); 1592 1581 if (!does_file_exist(fname)) { 1593 mr_asprintf(tmp, "Cannot find %s", fname); 1594 log_to_screen(tmp); 1595 mr_free(tmp); 1582 log_to_screen("Cannot find %s", fname); 1596 1583 return (1); 1597 1584 } … … 1636 1623 { 1637 1624 /*@ buffers **************************************************** */ 1638 char *tmp = NULL;1639 1625 char datablock[TAPE_BLOCK_SIZE]; 1640 1626 char *checksum = NULL; … … 1689 1675 p++; 1690 1676 } 1691 mr_asprintf(tmp, "Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10); 1692 log_it(tmp); 1693 mr_free(tmp); 1677 log_it("Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10); 1694 1678 write_header_block_to_stream(filesize, infile_basename, 1695 1679 BLK_START_FILE); … … 1761 1745 /*@ buffers **************************************************** */ 1762 1746 char tempblock[TAPE_BLOCK_SIZE]; 1763 char *tmp = NULL;1764 1747 char *p; 1765 1748 … … 1780 1763 } 1781 1764 if (!g_tape_stream) { 1782 log_to_screen 1783 ("You're not backing up to tape. Why write a tape header?"); 1765 log_to_screen("You're not backing up to tape. Why write a tape header?"); 1784 1766 return (1); 1785 1767 } … … 1791 1773 memcpy(tempblock + 7001, (char *) &olen, sizeof(off_t)); 1792 1774 strcpy(tempblock + 1000, filename); 1793 g_tape_posK += 1794 fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, 1795 g_tape_stream) / 1024; 1796 mr_asprintf(tmp, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10); 1797 log_msg(6, tmp); 1798 mr_free(tmp); 1775 g_tape_posK += fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, g_tape_stream) / 1024; 1776 log_msg(6, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10); 1799 1777 return (0); 1800 1778 } … … 1816 1794 void wrong_marker(int should_be, int it_is) 1817 1795 { 1818 /*@ buffer ***************************************************** */ 1819 char *tmp = NULL; 1820 1821 1822 /*@ end vars *************************************************** */ 1823 mr_asprintf(tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is)); 1824 log_to_screen(tmp); 1825 mr_free(tmp); 1796 log_to_screen("Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is)); 1826 1797 } 1827 1798 -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2323 r2324 828 828 bkpinfo->disaster_recovery = (am_I_in_disaster_recovery_mode()? TRUE : FALSE); 829 829 if (bkpinfo->disaster_recovery) { 830 mr_asprintf( p, "%s", "/");830 mr_asprintf(bkpinfo->isodir, "%s", "/"); 831 831 } else { 832 mr_asprintf(p, "%s", MONDO_CACHE); 833 } 834 bkpinfo->isodir = p; 835 mr_asprintf(p, "%s", STD_PREFIX); 836 bkpinfo->prefix = p; 837 bkpinfo->scratchdir = NULL; 838 bkpinfo->tmpdir = NULL; 832 mr_asprintf(bkpinfo->isodir, "%s", MONDO_CACHE); 833 } 834 mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX); 835 bkpinfo->scratchdir = NULL; // Really setup after 836 bkpinfo->tmpdir = NULL; // Really setup after 839 837 bkpinfo->optimal_set_size = 0; 840 838 bkpinfo->backup_media_type = none; … … 889 887 mr_free(command); 890 888 891 mr_asprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4", 892 partition); 889 mr_asprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4", partition); 893 890 mr_asprintf(out_sz, "%s", call_program_and_get_last_line_of_output(command)); 894 891 mr_free(command); … … 941 938 } 942 939 if (atol(tmp) < 66000) { 943 log_to_screen 944 ("WARNING! You have very little RAM. Please upgrade to 64MB or more."); 940 log_to_screen("WARNING! You have very little RAM. Please upgrade to 64MB or more."); 945 941 } 946 942 mr_free(tmp); … … 1080 1076 /*@ buffer ****************************************************** */ 1081 1077 char *command = NULL; 1082 char *tmp = NULL;1083 1078 1084 1079 /*@ end vars *************************************************** */ … … 1087 1082 assert_string_is_neither_NULL_nor_zerolength(label); 1088 1083 if (!does_file_exist(config_file)) { 1089 mr_asprintf(tmp, "(read_cfg_var) Cannot find %s config file", config_file); 1090 log_to_screen(tmp); 1091 mr_free(tmp); 1092 1084 log_to_screen("(read_cfg_var) Cannot find %s config file", config_file); 1093 1085 value[0] = '\0'; 1094 1086 return (1); … … 1252 1244 strcpy(g_boot_mountpt, tmp); 1253 1245 mr_free(tmp); 1254 mr_asprintf(tmp, "%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt); 1255 log_it(tmp); 1256 mr_free(tmp); 1246 log_it("%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt); 1257 1247 1258 1248 mr_asprintf(tmp, "mount %s", g_boot_mountpt); … … 1311 1301 char *command = NULL; 1312 1302 char *tempfile = NULL; 1313 char *tmp = NULL;1314 1303 1315 1304 … … 1319 1308 assert(value != NULL); 1320 1309 if (!does_file_exist(config_file)) { 1321 mr_asprintf(tmp, "(write_cfg_file) Cannot find %s config file", config_file); 1322 log_to_screen(tmp); 1323 mr_free(tmp); 1310 log_to_screen("(write_cfg_file) Cannot find %s config file", config_file); 1324 1311 return (1); 1325 1312 } -
branches/2.2.10/mondo/src/common/libmondo-verify.c
r2323 r2324 167 167 } else { 168 168 retval++; 169 mr_asprintf(tmp, "Warning - missing set(s) between %d and %d\n", g_last_afioball_number, set_number - 1); 170 log_to_screen(tmp); 171 mr_free(tmp); 169 log_to_screen("Warning - missing set(s) between %d and %d\n", g_last_afioball_number, set_number - 1); 172 170 } 173 171 } … … 666 664 if (strcmp(biggie_cksum, orig_cksum)) { 667 665 log_msg(2, "orig cksum=%s; curr cksum=%s", biggie_cksum, orig_cksum); 668 mr_asprintf(tmp, "%s has changed on live filesystem", biggie_fname); 669 log_to_screen(tmp); 670 mr_free(tmp); 666 log_to_screen("%s has changed on live filesystem", biggie_fname); 671 667 672 668 mr_asprintf(tmp, "echo \"%s\" >> %s/biggies.changed", biggie_fname, bkpinfo->tmpdir); … … 776 772 res = verify_an_afioball_from_stream(fname, size); 777 773 if (res) { 778 mr_asprintf(tmp, "Afioball %ld differs from live filesystem", current_afioball_number); 779 log_to_screen(tmp); 780 mr_free(tmp); 774 log_to_screen("Afioball %ld differs from live filesystem", current_afioball_number); 781 775 } 782 776 retval += res; … … 981 975 #endif 982 976 { 983 mr_asprintf(tmp, "%s failed; unable to unmount USB device\n", tmp1); 984 log_to_screen(tmp); 985 paranoid_free(tmp); 977 log_to_screen("%s failed; unable to unmount USB device\n", tmp1); 986 978 retval++; 987 979 } else { 988 980 log_msg(2, "OK, I've unmounted the USB device\n"); 989 981 } 990 paranoid_free(tmp1);991 paranoid_free(mountpoint);982 mr_free(tmp1); 983 mr_free(mountpoint); 992 984 return (retval); 993 985 } … … 1053 1045 mddevice = make_vn(fname); 1054 1046 if (ret) { 1055 mr_asprintf(tmp, "make_vn of %s failed; unable to verify ISO\n", fname); 1056 log_to_screen(tmp); 1057 mr_free(tmp); 1047 log_to_screen("make_vn of %s failed; unable to verify ISO\n", fname); 1058 1048 mr_free(mountpoint); 1059 1049 mr_free(fname); … … 1065 1055 #endif 1066 1056 if (run_program_and_log_output(command, FALSE)) { 1067 mr_asprintf(tmp, "%s failed; unable to mount ISO image\n", command); 1068 log_to_screen(tmp); 1069 mr_free(tmp); 1057 log_to_screen("%s failed; unable to mount ISO image\n", command); 1070 1058 mr_free(mountpoint); 1071 1059 mr_free(command); … … 1099 1087 ret += system(command); 1100 1088 ret += kick_vn(mddevice); 1101 if (ret) 1089 if (ret) { 1102 1090 #else 1103 1091 mr_asprintf(command, "umount %s", mountpoint); 1104 if (system(command)) 1092 if (system(command)) { 1105 1093 #endif 1106 { 1107 mr_asprintf(tmp, "%s failed; unable to unmount ISO image\n", command); 1108 log_to_screen(tmp); 1109 mr_free(tmp); 1094 log_to_screen("%s failed; unable to unmount ISO image\n", command); 1110 1095 1111 1096 retval++; -
branches/2.2.10/mondo/src/common/newt-specific.c
r2323 r2324 1079 1079 char *timeline_str = NULL; 1080 1080 char *taskprogress = NULL; 1081 char *tmp = NULL;1082 1081 1083 1082 if (!g_text_mode) { -
branches/2.2.10/mondo/src/mondoarchive/mondoarchive.c
r2323 r2324 362 362 res = verify_data(); 363 363 if (res < 0) { 364 mr_asprintf(tmp, "%d difference%c found.", -res, 365 (-res != 1) ? 's' : ' '); 364 mr_asprintf(tmp, "%d difference%c found.", -res, (-res != 1) ? 's' : ' '); 366 365 mr_asprintf(say_at_end, "%s", tmp); 367 366 log_to_screen(tmp); -
branches/2.2.10/mondo/src/mondorestore/mondo-prep.c
r2323 r2324 484 484 fgets(incoming, MAX_STR_LEN - 1, fin)); 485 485 if (!feof(fin)) { 486 mr_asprintf(tmp, "Investigating %s", old_mountlist->el[lino].device); 487 log_it(tmp); 488 mr_free(tmp); 486 log_it("Investigating %s", old_mountlist->el[lino].device); 489 487 490 488 for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) … … 497 495 *p = '\0'; 498 496 for (p--; p > incoming && *(p - 1) > 32; p--); 499 mr_asprintf(tmp, "Extrapolating %s", p); 500 log_it(tmp); 501 mr_free(tmp); 497 log_it("Extrapolating %s", p); 502 498 503 499 for (j = 0; … … 518 514 new_mountlist->entries++; 519 515 } else { 520 mr_asprintf(tmp, "Not adding %s to mountlist: it's already there", p); 521 log_it(tmp); 522 mr_free(tmp); 516 log_it("Not adding %s to mountlist: it's already there", p); 523 517 } 524 518 } … … 585 579 for (j = 1; j < raidlist->el[i].data_disks.entries; j++) { 586 580 mr_asprintf(strtmp, "%s", devices); 587 paranoid_free(devices); 588 mr_asprintf(devices, "%s %s", strtmp, 589 raidlist->el[i].data_disks.el[j].device); 590 paranoid_free(strtmp); 581 mr_free(devices); 582 mr_asprintf(devices, "%s %s", strtmp, raidlist->el[i].data_disks.el[j].device); 583 mr_free(strtmp); 591 584 } 592 585 for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) { 593 586 mr_asprintf(strtmp, "%s", devices); 594 paranoid_free(devices); 595 mr_asprintf(devices, "%s %s", strtmp, 596 raidlist->el[i].spare_disks.el[j].device); 597 paranoid_free(strtmp); 587 mr_free(devices); 588 mr_asprintf(devices, "%s %s", strtmp, raidlist->el[i].spare_disks.el[j].device); 589 mr_free(strtmp); 598 590 } 599 591 // translate RAID level … … 613 605 if (raidlist->el[i].parity != -1) { 614 606 mr_asprintf(strtmp, "%s", program); 615 paranoid_free(program);607 mr_free(program); 616 608 switch(raidlist->el[i].parity) { 617 609 case 0: … … 635 627 if (raidlist->el[i].chunk_size != -1) { 636 628 mr_asprintf(strtmp, "%s", program); 637 paranoid_free(program);629 mr_free(program); 638 630 mr_asprintf(program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size); 639 paranoid_free(strtmp);631 mr_free(strtmp); 640 632 } 641 633 if (raidlist->el[i].spare_disks.entries > 0) { 642 634 mr_asprintf(strtmp, "%s", program); 643 paranoid_free(program);635 mr_free(program); 644 636 mr_asprintf(program, "%s --spare-devices=%d", strtmp, raidlist->el[i].spare_disks.entries); 645 paranoid_free(strtmp);637 mr_free(strtmp); 646 638 } 647 639 mr_asprintf(strtmp, "%s", program); 648 paranoid_free(program);640 mr_free(program); 649 641 mr_asprintf(program, "%s %s", strtmp, devices); 650 paranoid_free(strtmp);642 mr_free(strtmp); 651 643 res = run_program_and_log_output(program, 1); 652 // free memory 653 paranoid_free(devices); 654 paranoid_free(level); 655 paranoid_free(program); 656 // return to calling instance 644 mr_free(devices); 645 mr_free(level); 646 mr_free(program); 657 647 return res; 658 648 } … … 688 678 689 679 if (strstr(format, "raid")) { // do not form RAID disks; do it to /dev/md* instead 690 mr_asprintf(tmp, "Not formatting %s (it is a RAID disk)", device); 691 log_it(tmp); 692 mr_free(tmp); 680 log_it("Not formatting %s (it is a RAID disk)", device); 693 681 return (0); 694 682 } … … 700 688 #endif 701 689 if (strlen(format) <= 2) { 702 mr_asprintf(tmp, "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format); 703 log_it(tmp); 704 mr_free(tmp); 690 log_it("%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format); 705 691 return (0); 706 692 } 707 693 if (is_this_device_mounted(device)) { 708 mr_asprintf(tmp, "%s is mounted - cannot format it ", device); 709 log_to_screen(tmp); 710 mr_free(tmp); 694 log_to_screen("%s is mounted - cannot format it ", device); 711 695 return (1); 712 696 } … … 736 720 char line[MAX_STR_LEN]; 737 721 738 mr_asprintf(tmp, "Initializing Vinum device %s (this may take a *long* time)", device); 739 log_to_screen(tmp); 740 mr_free(tmp); 722 log_to_screen("Initializing Vinum device %s (this may take a *long* time)", device); 741 723 742 724 /* format raid partition */ … … 782 764 } 783 765 #else 784 mr_asprintf(tmp, "Initializing RAID device %s", device);766 log_to_screen(tmp, "Initializing RAID device %s", device); 785 767 log_to_screen(tmp); 786 768 mr_free(tmp); … … 989 971 me = &mountlist->el[lino]; // the current mountlist entry 990 972 if (!strcmp(me->mountpoint, "image")) { 991 mr_asprintf(tmp, "Not formatting %s - it's an image", me->device); 992 log_it(tmp); 993 mr_free(tmp); 973 log_it("Not formatting %s - it's an image", me->device); 994 974 } else if (!strcmp(me->format, "raid")) { 995 mr_asprintf(tmp, "Not formatting %s - it's a raid-let", me->device); 996 log_it(tmp); 997 mr_free(tmp); 975 log_it("Not formatting %s - it's a raid-let", me->device); 998 976 continue; 999 977 } else if (!strcmp(me->format, "lvm")) { 1000 mr_asprintf(tmp, "Not formatting %s - it's an LVM", me->device); 1001 log_it(tmp); 1002 mr_free(tmp); 978 log_it("Not formatting %s - it's an LVM", me->device); 1003 979 continue; 1004 980 } else if (!strncmp(me->device, "/dev/md", 7)) { 1005 mr_asprintf(tmp, "Already formatted %s - it's a soft-RAID dev", me->device); 1006 log_it(tmp); 1007 mr_free(tmp); 981 log_it("Already formatted %s - it's a soft-RAID dev", me->device); 1008 982 continue; 1009 983 } else if (!does_file_exist(me->device) 1010 984 && strncmp(me->device, "/dev/hd", 7) 1011 985 && strncmp(me->device, "/dev/sd", 7)) { 1012 mr_asprintf(tmp, "Not formatting %s yet - doesn't exist - probably an LVM", me->device); 1013 log_it(tmp); 1014 mr_free(tmp); 986 log_it("Not formatting %s yet - doesn't exist - probably an LVM", me->device); 1015 987 continue; 1016 988 } else { … … 1048 1020 } 1049 1021 1050 mr_asprintf(tmp, "format_everything () - %s", (retval) ? "failed!" : "finished successfully"); 1051 log_it(tmp); 1052 mr_free(tmp); 1022 log_it("format_everything () - %s", (retval) ? "failed!" : "finished successfully"); 1053 1023 1054 1024 if (g_partition_table_locked_up > 0) { … … 1103 1073 int res; 1104 1074 1105 /** buffers **********************************************************/1106 char *tmp = NULL;1107 1108 1075 /** end **************************************************************/ 1109 1076 … … 1111 1078 1112 1079 if (devno_we_must_allow_for >= 5) { 1113 mr_asprintf(tmp, "Making dummy primary 1 on %s", drivename); 1114 log_it(tmp); 1115 mr_free(tmp); 1080 log_it("Making dummy primary 1 on %s", drivename); 1116 1081 1117 1082 g_maximum_progress++; … … 1127 1092 } 1128 1093 for (; current_devno < devno_we_must_allow_for; current_devno++) { 1129 mr_asprintf(tmp, "Creating dummy partition %d on %s", current_devno, drivename); 1130 log_it(tmp); 1131 mr_free(tmp); 1094 log_it("Creating dummy partition %d on %s", current_devno, drivename); 1132 1095 g_maximum_progress++; 1133 1096 res = … … 1468 1431 malloc_string(format); 1469 1432 1470 mr_asprintf(tmp, "Partitioning drive %s", drivename); 1471 log_it(tmp); 1472 mr_free(tmp); 1433 log_it("Partitioning drive %s", drivename); 1473 1434 1474 1435 #if __FreeBSD__ … … 1565 1526 file = open(drivename, O_WRONLY); 1566 1527 if (file != -1) { 1567 mr_asprintf(tmp, "Warning - unable to open %s for wiping it's partition table", drivename); 1568 log_to_screen(tmp); 1569 mr_free(tmp); 1528 log_to_screen("Warning - unable to open %s for wiping it's partition table", drivename); 1570 1529 } 1571 1530 1572 1531 for (i = 0; i < 512; i++) { 1573 1532 if (!write(file, "\0", 1)) { 1574 mr_asprintf(tmp, "Warning - unable to write to %s", drivename); 1575 log_to_screen(tmp); 1576 mr_free(tmp); 1533 log_to_screen("Warning - unable to write to %s", drivename); 1577 1534 } 1578 1535 } … … 1633 1590 1634 1591 if (pout_to_fdisk) { 1635 // mark relevant partition as bootable1592 // mark relevant partition as bootable 1636 1593 mr_asprintf(tmp, "a\n%s\n", call_program_and_get_last_line_of_output ("make-me-bootable /tmp/mountlist.txt dummy")); 1637 1594 fput_string_one_char_at_a_time(pout_to_fdisk, tmp); 1638 1595 mr_free(tmp); 1639 1596 1640 // close fdisk1597 // close fdisk 1641 1598 fput_string_one_char_at_a_time(pout_to_fdisk, "w\n"); 1642 1599 system("sync"); … … 1708 1665 1709 1666 if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) { 1710 mr_asprintf(tmp, "Not partitioning %s - it is a virtual drive", drive); 1711 log_it(tmp); 1712 mr_free(tmp); 1713 1667 log_it("Not partitioning %s - it is a virtual drive", drive); 1714 1668 return (0); 1715 1669 } … … 1725 1679 1726 1680 if (is_this_device_mounted(partition_name)) { 1727 mr_asprintf(tmp, "%s is mounted, and should not be partitioned", partition_name); 1728 log_to_screen(tmp); 1729 mr_free(tmp); 1681 log_to_screen("%s is mounted, and should not be partitioned", partition_name); 1730 1682 mr_free(partition_name); 1731 1683 return (1); … … 1769 1721 } 1770 1722 mr_strcat(output, "\n"); 1771 mr_asprintf(tmp,"PARTSIZE = +%ld",(long)partsize); 1772 log_it(tmp); 1773 mr_free(tmp); 1723 log_it("PARTSIZE = +%ld",(long)partsize); 1774 1724 1775 1725 log_it("---fdisk command---"); … … 1826 1776 format, -1); 1827 1777 if (res) { 1828 mr_asprintf(tmp, "Failed to vacuum-pack %s", partition_name); 1829 log_it(tmp); 1830 mr_free(tmp); 1778 log_it("Failed to vacuum-pack %s", partition_name); 1831 1779 1832 1780 retval++; … … 1840 1788 partsize); 1841 1789 if (retval) { 1842 mr_asprintf(tmp, "Partitioned %s but failed to set its type", partition_name); 1843 log_it(tmp); 1844 mr_free(tmp); 1790 log_it("Partitioned %s but failed to set its type", partition_name); 1845 1791 } else { 1846 1792 if (partsize > 0) { 1847 mr_asprintf(tmp, "Partition %s created+configured OK", partition_name); 1848 log_to_screen(tmp); 1849 mr_free(tmp); 1793 log_to_screen("Partition %s created+configured OK", partition_name); 1850 1794 } else { 1851 1795 log_it("Returning from a successful vacuum-pack"); … … 2425 2369 return; 2426 2370 } 2427 mr_asprintf(tmp, "Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive); 2428 log_to_screen(tmp); 2429 mr_free(tmp); 2371 log_to_screen("Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive); 2430 2372 2431 2373 drivemntlist = malloc(sizeof(struct mountlist_reference)); … … 2445 2387 2446 2388 if (original_size_of_drive <= 0) { 2447 mr_asprintf(tmp, "Cannot resize %s's entries. Drive not found.", drive_name); 2448 log_to_screen(tmp); 2449 mr_free(tmp); 2389 log_to_screen("Cannot resize %s's entries. Drive not found.", drive_name); 2450 2390 return; 2451 2391 } 2452 2392 factor = (float) (current_size_of_drive) / (float) (original_size_of_drive); 2453 mr_asprintf(tmp, "Disk %s was %ld MB; is now %ld MB; factor = %f", drive_name, original_size_of_drive, current_size_of_drive, factor); 2454 log_to_screen(tmp); 2455 mr_free(tmp); 2393 log_to_screen("Disk %s was %ld MB; is now %ld MB; factor = %f", drive_name, original_size_of_drive, current_size_of_drive, factor); 2456 2394 2457 2395 lastpart = drivemntlist->entries - 1; … … 2478 2416 } 2479 2417 2480 mr_asprintf(tmp, "Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL); 2481 log_to_screen(tmp); 2482 mr_free(tmp); 2418 log_to_screen("Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL); 2483 2419 drivemntlist->el[partno]->size = newsizL; 2484 2420 } 2485 2421 final_size = get_phys_size_of_drive(drive_name); 2486 mr_asprintf(tmp, "final_size = %ld MB", final_size); 2487 log_to_screen(tmp); 2488 mr_free(tmp); 2422 log_to_screen("final_size = %ld MB", final_size); 2489 2423 } 2490 2424 -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c
r2323 r2324 79 79 insist_on_this_cd_number((++g_current_media_number)); 80 80 } else { 81 mr_asprintf(tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob."); 82 log_msg(2, tmp_ptr); 83 paranoid_free(tmp_ptr); 81 log_msg(2, "No CD's left. No biggiefiles left. No prob, Bob."); 84 82 return (0); 85 83 } 86 84 } 87 85 if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) { 88 mr_asprintf(tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr); 89 log_to_screen(tmp_ptr); 90 paranoid_free(tmp_ptr); 86 log_to_screen("Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr); 91 87 return (1); 92 88 } -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2323 r2324 272 272 if (!bkpinfo->isodir[0]) { 273 273 mr_free(bkpinfo->isodir); 274 mr_asprintf(p, "/tmp/isodir"); 275 bkpinfo->isodir = p; 274 mr_asprintf(bkpinfo->isodir, "/tmp/isodir"); 276 275 } 277 276 /* End patch */ … … 498 497 "Again with the /proc - why is this in your mountlist?"); 499 498 } else if (is_this_device_mounted(mountlist->el[lino].device)) { 500 mr_asprintf(tmp, "%s is already mounted", mountlist->el[lino].device); 501 log_to_screen(tmp); 502 mr_free(tmp); 499 log_to_screen("%s is already mounted", mountlist->el[lino].device); 503 500 } else if (strcmp(mountlist->el[lino].mountpoint, "none") 504 501 && strcmp(mountlist->el[lino].mountpoint, "lvm") … … 595 592 if (!strcmp(bkpinfo->isodir, "/") && am_I_in_disaster_recovery_mode()) { 596 593 mr_free(bkpinfo->isodir); 597 mr_asprintf(p, "/tmp/isodir"); 598 bkpinfo->isodir = p; 594 mr_asprintf(bkpinfo->isodir, "/tmp/isodir"); 599 595 log_msg(1, "isodir is being set to %s", bkpinfo->isodir); 600 596 } … … 772 768 mr_free(bkpinfo->prefix); 773 769 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 774 mr_asprintf(tmp1, "%s", value); 775 } else { 776 mr_asprintf(tmp1, "%s", STD_PREFIX); 777 } 778 bkpinfo->prefix = tmp1; 770 mr_asprintf(bkpinfo->prefix, "%s", value); 771 } else { 772 mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX); 773 } 779 774 } else if (!strcmp(value, "nfs")) { 780 775 bkpinfo->backup_media_type = nfs; … … 782 777 mr_free(bkpinfo->prefix); 783 778 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 784 mr_asprintf(tmp1, "%s", value); 785 } else { 786 mr_asprintf(tmp1, "%s", STD_PREFIX); 787 } 788 bkpinfo->prefix = tmp1; 779 mr_asprintf(bkpinfo->prefix, "%s", value); 780 } else { 781 mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX); 782 } 789 783 790 784 if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "pxe")) { … … 796 790 } 797 791 mr_free(bkpinfo->prefix); 798 mr_asprintf(tmp1, "%s", envtmp1); 799 bkpinfo->prefix = tmp1; 792 mr_asprintf(bkpinfo->prefix, "%s", envtmp1); 800 793 } 801 794 … … 970 963 read_cfg_var(g_mondo_cfg_file, "isodir", iso_path); 971 964 mr_free(bkpinfo->isodir); 972 mr_asprintf(tmp1, "%s%s", iso_mnt, iso_path); 973 bkpinfo->isodir = tmp1; 965 mr_asprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path); 974 966 if (!bkpinfo->isodir[0]) { 975 967 mr_free(bkpinfo->isodir); … … 2012 2004 } 2013 2005 mr_asprintf(tmp, "Unmounting device %s ", mountlist->el[lino].device); 2014 2015 2006 update_progress_form(tmp); 2016 2007 … … 2194 2185 } 2195 2186 mr_asprintf(tmp, "%s", bkpinfo->media_device); 2196 if (extract_cfg_file_and_mountlist_from_tape_dev 2197 (bkpinfo->media_device)) { 2187 if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) { 2198 2188 strcpy(bkpinfo->media_device, "/dev/st0"); 2199 if (extract_cfg_file_and_mountlist_from_tape_dev 2200 (bkpinfo->media_device)) { 2189 if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) { 2201 2190 strcpy(bkpinfo->media_device, "/dev/osst0"); 2202 if (extract_cfg_file_and_mountlist_from_tape_dev 2203 (bkpinfo->media_device)) { 2191 if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) { 2204 2192 strcpy(bkpinfo->media_device, "/dev/ht0"); 2205 if (extract_cfg_file_and_mountlist_from_tape_dev 2206 (bkpinfo->media_device)) { 2207 log_msg(3, 2208 "I tried lots of devices but none worked."); 2193 if (extract_cfg_file_and_mountlist_from_tape_dev (bkpinfo->media_device)) { 2194 log_msg(3, "I tried lots of devices but none worked."); 2209 2195 strcpy(bkpinfo->media_device, tmp); 2210 2196 } … … 2343 2329 /* @} - end restoreUtilityGroup */ 2344 2330 2345 2346 /***************************************************************************2347 * F@ *2348 * () -- Hugo Rabson *2349 * *2350 * Purpose: *2351 * *2352 * Called by: *2353 * Params: - - *2354 * Returns: 0=success; nonzero=failure *2355 ***************************************************************************/2356 2357 2358 2359 2331 void wait_until_software_raids_are_prepped(char *mdstat_file, 2360 2332 int wait_for_percentage) -
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2323 r2324 918 918 popup_and_OK(tmp); 919 919 mr_free(tmp); 920 log_to_screen 921 ("Mondo has restored your system. Please wait for the command prompt."); 922 log_to_screen 923 ("Then remove the backup media and reboot."); 924 log_to_screen 925 ("Please visit our website at http://www.mondorescue.org for more information."); 920 log_to_screen("Mondo has restored your system. Please wait for the command prompt."); 921 log_to_screen("Then remove the backup media and reboot."); 922 log_to_screen("Please visit our website at http://www.mondorescue.org for more information."); 926 923 } 927 924 g_I_have_just_nuked = TRUE; … … 1159 1156 use_ntfsprog_hack = TRUE; 1160 1157 log_msg(2, "Calling ntfsclone in background because %s is an NTFS /dev entry", outfile_fname); 1161 mr_asprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768), 1162 (int) (random() % 32768)); 1158 mr_asprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768), (int) (random() % 32768)); 1163 1159 mkfifo(sz_devfile, 0x770); 1164 1160 strcpy(ntfsprog_fifo, sz_devfile); … … 1232 1228 mr_free(mds); 1233 1229 1234 mr_asprintf(tmp, "Restoring from %s #%d", mds, g_current_media_number); 1235 log_to_screen(tmp); 1236 mr_free(tmp); 1230 log_to_screen("Restoring from %s #%d", mds, g_current_media_number); 1237 1231 1238 1232 insist_on_this_cd_number(g_current_media_number); … … 1279 1273 mr_free(tmp); 1280 1274 if (bzip2_command != NULL) { 1281 mr_strcat(bzip2_command, " -dc %s 2>> %s", 1282 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1275 mr_strcat(bzip2_command, " -dc %s 2>> %s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1283 1276 } else { 1284 mr_asprintf(bzip2_command, "cat %s 2>> %s", 1285 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1277 mr_asprintf(bzip2_command, "cat %s 2>> %s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1286 1278 } 1287 1279 mds = media_descriptor_string(bkpinfo->backup_media_type); … … 1627 1619 char *executable = NULL; 1628 1620 char *temp_log = NULL; 1629 char *screen_message = NULL;1630 1621 long matches = 0; 1631 1622 bool use_star; … … 1654 1645 log_msg(3, "length_of_file(%s) = %llu", tarball_fname, length_of_file(tarball_fname)); 1655 1646 log_msg(3, "count_lines_in_file(%s) = %llu", tarball_fname, count_lines_in_file(tarball_fname)); 1656 mr_asprintf(tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number); 1657 log_to_screen(tmp); 1658 mr_free(tmp); 1647 log_to_screen("Unable to restore fileset #%ld (CD I/O error)", current_tarball_number); 1659 1648 mr_free(filelist_name); 1660 1649 log_msg(5, "Leaving"); … … 1672 1661 log_msg(3, "Saved fileset %ld's subset to %s", current_tarball_number, filelist_subset_fname); 1673 1662 } 1674 mr_asprintf(screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches); 1675 log_to_screen(screen_message); 1676 mr_free(screen_message); 1663 log_to_screen("Tarball #%ld --- %ld matches", current_tarball_number, matches); 1677 1664 } 1678 1665 mr_free(filelist_name); … … 2066 2053 } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 2067 2054 insist_on_this_cd_number(++g_current_media_number); 2068 mr_asprintf(tmp1, "Restoring from %s #%d", mds, g_current_media_number); 2069 log_to_screen(tmp1); 2070 mr_free(tmp1); 2055 log_to_screen("Restoring from %s #%d", mds, g_current_media_number); 2071 2056 just_changed_cds = TRUE; 2072 2057 } else { … … 2228 2213 } else { 2229 2214 mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number); 2230 for (res = 999, attempts = 0; attempts < 3 && res != 0; 2231 attempts++) { 2232 res = 2233 restore_a_tarball_from_CD(tarball_fname, 2234 current_tarball_number, 2235 filelist); 2215 for (res = 999, attempts = 0; attempts < 3 && res != 0; attempts++) { 2216 res = restore_a_tarball_from_CD(tarball_fname, current_tarball_number, filelist); 2236 2217 } 2237 2218 mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number); … … 2247 2228 } 2248 2229 strcpy(comment, tmp1); 2249 paranoid_free(tmp1);2230 mr_free(tmp1); 2250 2231 if (attempts > 1) { 2251 2232 log_to_screen(comment); … … 2519 2500 retval += res; 2520 2501 if (res) { 2521 mr_asprintf(tmp, "Fileset %ld - errors occurred", current_afioball_number); 2522 log_to_screen(tmp); 2523 mr_free(tmp); 2502 log_to_screen("Fileset %ld - errors occurred", current_afioball_number); 2524 2503 } 2525 2504 res = … … 2958 2937 log_msg(1, "Mounting nfs dir"); 2959 2938 mr_free(bkpinfo->isodir); 2960 mr_asprintf(tmp, "/tmp/isodir"); 2961 bkpinfo->isodir = tmp; 2939 mr_asprintf(bkpinfo->isodir, "/tmp/isodir"); 2962 2940 run_program_and_log_output("mkdir -p /tmp/isodir", 5); 2963 2941 mr_asprintf(tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount); … … 2968 2946 2969 2947 if (retval) { 2970 log_to_screen 2971 ("Warning - load_raidtab_into_raidlist returned an error"); 2948 log_to_screen("Warning - load_raidtab_into_raidlist returned an error"); 2972 2949 } 2973 2950 … … 3079 3056 set_signals(FALSE); 3080 3057 log_to_screen("Restore log (%s) copied to /var/log on your hard disk", MONDO_LOGFILE); 3081 mr_asprintf(tmp, "Mondo-restore is exiting (retval=%d) ", retval); 3082 log_to_screen(tmp); 3083 mr_free(tmp); 3058 log_to_screen("Mondo-restore is exiting (retval=%d) ", retval); 3084 3059 3085 3060 mr_asprintf(tmp, "umount %s", bkpinfo->isodir);
Note:
See TracChangeset
for help on using the changeset viewer.