Changeset 2323 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-archive.c
- Timestamp:
- Aug 18, 2009, 3:05:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2322 r2323 202 202 203 203 if (!does_file_exist(filelist)) { 204 mr_asprintf( &tmp, "(archive_this_fileset) - filelist %s does not exist", filelist);204 mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", filelist); 205 205 log_to_screen(tmp); 206 206 paranoid_free(tmp); … … 208 208 } 209 209 210 mr_asprintf( &tmp, "echo hi > %s 2> /dev/null", fname);210 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname); 211 211 if (system(tmp)) { 212 212 paranoid_free(tmp); … … 215 215 paranoid_free(tmp); 216 216 217 mr_asprintf( &command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s",217 mr_asprintf(command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s", 218 218 filelist, fname); 219 219 if (bkpinfo->use_lzo) { … … 229 229 log_msg(5, "command='%s'", command); 230 230 res = system(command); 231 mr_asprintf( &tmp, "%s", last_line_of_file(MONDO_LOGFILE));231 mr_asprintf(tmp, "%s", last_line_of_file(MONDO_LOGFILE)); 232 232 log_msg(1, "res=%d; tmp='%s'", res, tmp); 233 233 if (bkpinfo->use_star && (res == 254 || res == 65024) … … 309 309 310 310 if (!does_file_exist(filelist)) { 311 mr_asprintf( &tmp, "(archive_this_fileset) - filelist %s does not exist",311 mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", 312 312 filelist); 313 313 log_to_screen(tmp); … … 315 315 return (1); 316 316 } 317 mr_asprintf( &tmp, "echo hi > %s 2> /dev/null", fname);317 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname); 318 318 if (system(tmp)) { 319 319 paranoid_free(tmp); … … 324 324 325 325 if (bkpinfo->compression_level > 0) { 326 mr_asprintf( &tmp, "%s/do-not-compress-these", g_mondo_home);326 mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home); 327 327 // -b %ld, TAPE_BLOCK_SIZE 328 mr_asprintf( &zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe,328 mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe, 329 329 bkpinfo->compression_level); 330 330 if (does_file_exist(tmp)) { … … 335 335 paranoid_free(tmp); 336 336 } else { 337 mr_asprintf( &zipparams, "");337 mr_asprintf(zipparams, ""); 338 338 } 339 339 … … 346 346 fatal_error("scratchdir not found"); 347 347 } 348 mr_asprintf( &command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname,348 mr_asprintf(command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname, 349 349 fname, bkpinfo->zip_suffix); 350 350 paranoid_system(command); 351 351 paranoid_free(command); 352 352 353 mr_asprintf( &command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);353 mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE); 354 354 paranoid_free(zipparams); 355 355 356 mr_asprintf( &tmp, "echo hi > %s 2> /dev/null", fname);356 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname); 357 357 if (system(tmp)) { 358 358 paranoid_free(tmp); … … 429 429 } 430 430 431 mr_asprintf( &tmp, "gzip -9 %s/archives/filelist.full", bkpinfo->scratchdir);431 mr_asprintf(tmp, "gzip -9 %s/archives/filelist.full", bkpinfo->scratchdir); 432 432 if (run_program_and_log_output(tmp, 2)) { 433 433 mr_free(tmp); … … 436 436 mr_free(tmp); 437 437 438 mr_asprintf( &tmp, "cp -f %s/archives/*list*.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);438 mr_asprintf(tmp, "cp -f %s/archives/*list*.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir); 439 439 if (run_program_and_log_output(tmp, 2)) { 440 440 mr_free(tmp); … … 461 461 } 462 462 retval += do_that_initial_phase(); // prepare 463 mr_asprintf( &tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir);463 mr_asprintf(tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir); 464 464 run_program_and_log_output(tmp, 1); 465 465 mr_free(tmp); … … 541 541 assert(bkpinfo != NULL); 542 542 if (bkpinfo->exclude_paths) { 543 mr_asprintf( &tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", bkpinfo->exclude_paths);544 mr_asprintf( &devs_to_exclude, "%s", call_program_and_get_last_line_of_output(tmp));543 mr_asprintf(tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", bkpinfo->exclude_paths); 544 mr_asprintf(devs_to_exclude, "%s", call_program_and_get_last_line_of_output(tmp)); 545 545 mr_free(tmp); 546 546 547 mr_asprintf( &tmp, "devs_to_exclude = '%s'", devs_to_exclude);547 mr_asprintf(tmp, "devs_to_exclude = '%s'", devs_to_exclude); 548 548 log_msg(2, tmp); 549 549 mr_free(tmp); … … 552 552 mvaddstr_and_log_it(g_currentY, 0, 553 553 "Calling MINDI to create boot+data disks"); 554 mr_asprintf( &tmp, "%s/filelist.full", bkpinfo->tmpdir);554 mr_asprintf(tmp, "%s/filelist.full", bkpinfo->tmpdir); 555 555 if (!does_file_exist(tmp)) { 556 556 mr_free(tmp); 557 mr_asprintf( &tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);557 mr_asprintf(tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir); 558 558 if (!does_file_exist(tmp)) { 559 559 fatal_error … … 564 564 mr_free(tmp); 565 565 566 mr_asprintf( &tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);567 mr_asprintf( &last_filelist_number, "%s", last_line_of_file(tmp));566 mr_asprintf(tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir); 567 mr_asprintf(last_filelist_number, "%s", last_line_of_file(tmp)); 568 568 mr_free(tmp); 569 569 570 570 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 571 mr_asprintf( &tape_size_sz, "%ld", bkpinfo->media_size[1]);571 mr_asprintf(tape_size_sz, "%ld", bkpinfo->media_size[1]); 572 572 ntapedev = get_non_rewind_dev(bkpinfo->media_device); 573 573 if ((bkpinfo->use_obdr) && (ntapedev != NULL)) { … … 579 579 } 580 580 paranoid_free(ntapedev); 581 mr_asprintf( &tape_device, "%s", bkpinfo->media_device);581 mr_asprintf(tape_device, "%s", bkpinfo->media_device); 582 582 } else { 583 mr_asprintf( &tape_size_sz, "%ld", 0L);;584 mr_asprintf( &tape_device, "");583 mr_asprintf(tape_size_sz, "%ld", 0L);; 584 mr_asprintf(tape_device, ""); 585 585 } 586 586 if (bkpinfo->use_lzo) { 587 mr_asprintf( &use_lzo_sz, "yes");587 mr_asprintf(use_lzo_sz, "yes"); 588 588 } else { 589 mr_asprintf( &use_lzo_sz, "no");589 mr_asprintf(use_lzo_sz, "no"); 590 590 } 591 591 if (bkpinfo->use_gzip) { 592 mr_asprintf( &use_gzip_sz, "yes");592 mr_asprintf(use_gzip_sz, "yes"); 593 593 } else { 594 mr_asprintf( &use_gzip_sz, "no");594 mr_asprintf(use_gzip_sz, "no"); 595 595 } 596 596 if (bkpinfo->use_star) { 597 mr_asprintf( &use_star_sz, "yes");597 mr_asprintf(use_star_sz, "yes"); 598 598 } else { 599 mr_asprintf( &use_star_sz, "no");599 mr_asprintf(use_star_sz, "no"); 600 600 } 601 601 602 602 if (bkpinfo->compression_level > 0) { 603 mr_asprintf( &use_comp_sz, "yes");603 mr_asprintf(use_comp_sz, "yes"); 604 604 } else { 605 mr_asprintf( &use_comp_sz, "no");606 } 607 608 mr_asprintf( &broken_bios_sz, "yes"); /* assume so */605 mr_asprintf(use_comp_sz, "no"); 606 } 607 608 mr_asprintf(broken_bios_sz, "yes"); /* assume so */ 609 609 if (g_cd_recovery) { 610 mr_asprintf( &cd_recovery_sz, "yes");610 mr_asprintf(cd_recovery_sz, "yes"); 611 611 } else { 612 mr_asprintf( &cd_recovery_sz, "no");612 mr_asprintf(cd_recovery_sz, "no"); 613 613 } 614 614 if (bkpinfo->make_cd_use_lilo) { 615 mr_asprintf( &use_lilo_sz, "yes");615 mr_asprintf(use_lilo_sz, "yes"); 616 616 } else { 617 mr_asprintf( &use_lilo_sz, "no");617 mr_asprintf(use_lilo_sz, "no"); 618 618 } 619 619 … … 623 623 624 624 #ifdef __FreeBSD__ 625 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output625 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 626 626 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 627 627 if (!bootdev[0]) { 628 628 mr_free(bootdev); 629 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output629 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 630 630 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 631 631 } … … 633 633 /* Linux */ 634 634 #ifdef __IA64__ 635 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output635 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 636 636 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 637 637 #else 638 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output638 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 639 639 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 640 640 #endif … … 642 642 mr_free(bootdev); 643 643 #ifdef __IA64__ 644 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output644 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 645 645 ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 646 646 #else 647 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output647 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 648 648 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 649 649 #endif … … 651 651 if (!bootdev[0]) { 652 652 mr_free(bootdev); 653 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output653 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 654 654 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 655 655 if (strstr(bootdev, "/dev/cciss/")) { 656 656 mr_free(bootdev); 657 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output657 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 658 658 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 659 659 } … … 666 666 ch = 'U'; 667 667 if (bkpinfo->boot_loader != '\0') { 668 mr_asprintf( &tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);668 mr_asprintf(tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader); 669 669 log_msg(2, tmp); 670 670 mr_free(tmp); … … 673 673 } 674 674 if (bkpinfo->boot_device[0] != '\0') { 675 mr_asprintf( &tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);675 mr_asprintf(tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device); 676 676 log_msg(2, tmp); 677 677 mr_free(tmp); … … 696 696 } 697 697 if (bkpinfo->boot_loader == 'L') { 698 mr_asprintf( &bootldr_str, "LILO");698 mr_asprintf(bootldr_str, "LILO"); 699 699 if (!does_file_exist("/etc/lilo.conf")) { 700 700 fatal_error … … 702 702 } 703 703 } else if (bkpinfo->boot_loader == 'G') { 704 mr_asprintf( &bootldr_str, "GRUB");704 mr_asprintf(bootldr_str, "GRUB"); 705 705 if (!does_file_exist("/boot/grub/menu.lst") 706 706 && does_file_exist("/boot/grub/grub.conf")) { … … 713 713 } 714 714 } else if (bkpinfo->boot_loader == 'E') { 715 mr_asprintf( &bootldr_str, "ELILO");715 mr_asprintf(bootldr_str, "ELILO"); 716 716 /* BCO: fix it for Debian, Mandrake, ... */ 717 717 if (!does_file_exist("/etc/elilo.conf") … … 744 744 } 745 745 } else if (bkpinfo->boot_loader == 'R') { 746 mr_asprintf( &bootldr_str, "RAW");746 mr_asprintf(bootldr_str, "RAW"); 747 747 } 748 748 #ifdef __FreeBSD__ 749 749 else if (bkpinfo->boot_loader == 'D') { 750 mr_asprintf( &bootldr_str, "DD");750 mr_asprintf(bootldr_str, "DD"); 751 751 } 752 752 753 753 else if (bkpinfo->boot_loader == 'B') { 754 mr_asprintf( &bootldr_str, "BOOT0");754 mr_asprintf(bootldr_str, "BOOT0"); 755 755 } 756 756 #endif 757 757 else { 758 mr_asprintf( &bootldr_str, "unknown");759 } 760 mr_asprintf( &tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);758 mr_asprintf(bootldr_str, "unknown"); 759 } 760 mr_asprintf(tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device); 761 761 log_to_screen(tmp); 762 762 mr_free(tmp); 763 763 764 mr_asprintf( &tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir);764 mr_asprintf(tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir); 765 765 if (write_one_liner_data_file(tmp, bkpinfo->boot_device)) { 766 766 log_msg(1, "%ld: Unable to write one-liner boot device", __LINE__); … … 770 770 switch (bkpinfo->backup_media_type) { 771 771 case cdr: 772 mr_asprintf( &value, "cdr");772 mr_asprintf(value, "cdr"); 773 773 break; 774 774 case cdrw: 775 mr_asprintf( &value, "cdrw");775 mr_asprintf(value, "cdrw"); 776 776 break; 777 777 case cdstream: 778 mr_asprintf( &value, "cdstream");778 mr_asprintf(value, "cdstream"); 779 779 break; 780 780 case tape: 781 mr_asprintf( &value, "tape");781 mr_asprintf(value, "tape"); 782 782 break; 783 783 case udev: 784 mr_asprintf( &value, "udev");784 mr_asprintf(value, "udev"); 785 785 break; 786 786 case iso: 787 mr_asprintf( &value, "iso");787 mr_asprintf(value, "iso"); 788 788 break; 789 789 case nfs: 790 mr_asprintf( &value, "nfs");790 mr_asprintf(value, "nfs"); 791 791 break; 792 792 case dvd: 793 mr_asprintf( &value, "dvd");793 mr_asprintf(value, "dvd"); 794 794 break; 795 795 case usb: 796 mr_asprintf( &value, "usb");796 mr_asprintf(value, "usb"); 797 797 break; 798 798 default: … … 800 800 } 801 801 if (bkpinfo->backup_media_type == usb) { 802 mr_asprintf( &tmp2, "--usb %s", bkpinfo->media_device);802 mr_asprintf(tmp2, "--usb %s", bkpinfo->media_device); 803 803 } else { 804 mr_asprintf( &tmp2," ");805 } 806 807 mr_asprintf( &tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir);804 mr_asprintf(tmp2," "); 805 } 806 807 mr_asprintf(tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir); 808 808 if (write_one_liner_data_file(tmp, value)) { 809 809 res++; … … 814 814 mr_free(tmp); 815 815 816 mr_asprintf( &tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir);816 mr_asprintf(tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir); 817 817 if (write_one_liner_data_file(tmp, bootldr_str)) { 818 818 res++; … … 823 823 mr_free(tmp); 824 824 825 mr_asprintf( &tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);825 mr_asprintf(tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir); 826 826 if (bkpinfo->differential) { 827 827 res += write_one_liner_data_file(tmp, "1"); … … 832 832 833 833 if (g_getfattr) { 834 mr_asprintf( &tmp1, "%s/XATTR", bkpinfo->tmpdir);834 mr_asprintf(tmp1, "%s/XATTR", bkpinfo->tmpdir); 835 835 if (write_one_liner_data_file(tmp1, "TRUE")) { 836 836 log_msg(1, "%ld: Unable to write one-liner XATTR", … … 840 840 } 841 841 if (g_getfacl) { 842 mr_asprintf( &tmp1, "%s/ACL", bkpinfo->tmpdir);842 mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir); 843 843 if (write_one_liner_data_file(tmp1, "TRUE")) { 844 844 log_msg(1, "%ld: Unable to write one-liner ACL", … … 848 848 } 849 849 if (bkpinfo->use_obdr) { 850 mr_asprintf( &tmp1, "%s/OBDR", bkpinfo->tmpdir);850 mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir); 851 851 if (write_one_liner_data_file(tmp1, "TRUE")) { 852 852 log_msg(1, "%ld: Unable to write one-liner OBDR", … … 859 859 size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1; 860 860 /* add nfs stuff here? */ 861 mr_asprintf( &command, "mkdir -p %s/images", bkpinfo->scratchdir);861 mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir); 862 862 if (system(command)) { 863 863 res++; … … 867 867 log_msg(1, "lines_in_filelist = %ld", lines_in_filelist); 868 868 869 /* "mindi 1=%s --custom 2=%s 3=%s/images 4=\"%s\" 5=\"%s\" \ 869 mr_asprintf(command, 870 /* "mindi --custom 2=%s 3=%s/images 4=\"%s\" 5=\"%s\" \ 870 871 6=\"%s\" 7=%ld 8=\"%s\" 9=\"%s\" 10=\"%s\" \ 871 872 11=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/ … … 919 920 if (!res) { 920 921 log_to_screen("Boot+data disks were created OK"); 921 mr_asprintf( &command, "cp -f %s/images/mindi.iso %s/mondorescue.iso", bkpinfo->scratchdir, MINDI_CACHE);922 mr_asprintf(command, "cp -f %s/images/mindi.iso %s/mondorescue.iso", bkpinfo->scratchdir, MINDI_CACHE); 922 923 log_msg(2, command); 923 924 run_program_and_log_output(command, FALSE); … … 925 926 926 927 if (bkpinfo->nonbootable_backup) { 927 mr_asprintf( &command, "cp -f %s/all.tar.gz %s/images", bkpinfo->tmpdir, bkpinfo->scratchdir);928 mr_asprintf(command, "cp -f %s/all.tar.gz %s/images", bkpinfo->tmpdir, bkpinfo->scratchdir); 928 929 if (system(command)) { 929 930 paranoid_free(command); … … 934 935 /* For USB we already have everything on the key */ 935 936 if (bkpinfo->backup_media_type == usb) { 936 mr_asprintf( &command, "rm -rf %s/images", bkpinfo->scratchdir);937 mr_asprintf(command, "rm -rf %s/images", bkpinfo->scratchdir); 937 938 run_program_and_log_output(command, FALSE); 938 939 paranoid_free(command); 939 940 } else { 940 mr_asprintf( &tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);941 mr_asprintf(tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir); 941 942 if (system(tmp)) { 942 943 fatal_error("Cannot find all.tar.gz in tmpdir"); … … 951 952 } else { 952 953 log_to_screen("Mindi failed to create your boot+data disks."); 953 mr_asprintf( &command, "grep 'Fatal error' /var/log/mindi.log");954 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));954 mr_asprintf(command, "grep 'Fatal error' /var/log/mindi.log"); 955 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 955 956 paranoid_free(command); 956 957 … … 1058 1059 } 1059 1060 1060 mr_asprintf( &tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix);1061 mr_asprintf(tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix); 1061 1062 if (does_file_exist(tmp)) { 1062 1063 log_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES, … … 1072 1073 this_thread_no, archiving_set_no); 1073 1074 if (g_getfattr) { 1074 mr_asprintf( &curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);1075 mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no); 1075 1076 get_fattr_list(archiving_filelist_fname, curr_xattr_list_fname); 1076 1077 mr_free(curr_xattr_list_fname); 1077 1078 } 1078 1079 if (g_getfacl) { 1079 mr_asprintf( &curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);1080 mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no); 1080 1081 get_acl_list(archiving_filelist_fname, curr_acl_list_fname); 1081 1082 mr_free(curr_acl_list_fname); … … 1091 1092 1092 1093 if (res) { 1093 mr_asprintf( &tmp, "Errors occurred while archiving set %ld. Please review logs.", archiving_set_no);1094 mr_asprintf(tmp, "Errors occurred while archiving set %ld. Please review logs.", archiving_set_no); 1094 1095 log_to_screen(tmp); 1095 1096 mr_free(tmp); … … 1209 1210 1210 1211 assert(bkpinfo != NULL); 1211 mr_asprintf( &data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir);1212 1213 mr_asprintf( &g_serial_string, "%s", call_program_and_get_last_line_of_output("dd if=/dev/urandom bs=16 count=1 2> /dev/null | hexdump | tr -s ' ' '0' | head -n1"));1212 mr_asprintf(data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir); 1213 1214 mr_asprintf(g_serial_string, "%s", call_program_and_get_last_line_of_output("dd if=/dev/urandom bs=16 count=1 2> /dev/null | hexdump | tr -s ' ' '0' | head -n1")); 1214 1215 mr_strip_spaces(g_serial_string); 1215 1216 mr_strcat(g_serial_string, "...word."); 1216 1217 log_msg(2, "g_serial_string = '%s'", g_serial_string); 1217 1218 1218 mr_asprintf( &tmpfile, "%s/archives/SERIAL-STRING", bkpinfo->scratchdir);1219 mr_asprintf(tmpfile, "%s/archives/SERIAL-STRING", bkpinfo->scratchdir); 1219 1220 if (write_one_liner_data_file(tmpfile, g_serial_string)) { 1220 1221 log_msg(1, "%ld: Failed to write serial string", __LINE__); … … 1243 1244 mr_free(data_disks_file); 1244 1245 1245 mr_asprintf( &command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix);1246 mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix); 1246 1247 paranoid_system(command); 1247 1248 mr_free(command); … … 1409 1410 } else { 1410 1411 // store set N 1411 mr_asprintf( &storing_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);1412 mr_asprintf( &storing_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no, bkpinfo->zip_suffix);1412 mr_asprintf(storing_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no); 1413 mr_asprintf(storing_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no, bkpinfo->zip_suffix); 1413 1414 if (g_getfattr) { 1414 mr_asprintf( &curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);1415 mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no); 1415 1416 } 1416 1417 if (g_getfacl) { 1417 mr_asprintf( &curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);1418 mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no); 1418 1419 } 1419 1420 … … 1469 1470 mr_free(media_usage_comment); 1470 1471 if (res) { 1471 mr_asprintf( &tmp, "Failed to add archive %ld's files to CD dir\n", storing_set_no);1472 mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", storing_set_no); 1472 1473 log_to_screen(tmp); 1473 1474 paranoid_free(tmp); … … 1489 1490 close_progress_form(); 1490 1491 1491 mr_asprintf( &tmp, "Your regular files have been archived ");1492 mr_asprintf(tmp, "Your regular files have been archived "); 1492 1493 log_msg(2, "Joining background threads to foreground thread"); 1493 1494 for (i = 0; i < noof_threads; i++) { … … 1555 1556 log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir); 1556 1557 (void) getcwd(old_pwd, MAX_STR_LEN - 1); 1557 mr_asprintf( &tmp, "chmod 755 %s", bkpinfo->scratchdir);1558 mr_asprintf(tmp, "chmod 755 %s", bkpinfo->scratchdir); 1558 1559 run_program_and_log_output(tmp, FALSE); 1559 1560 paranoid_free(tmp); … … 1561 1562 1562 1563 mds = media_descriptor_string(bkpinfo->backup_media_type); 1563 mr_asprintf( &message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number);1564 mr_asprintf(message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number); 1564 1565 mr_free(mds); 1565 1566 log_msg(1, message_to_screen); 1566 1567 1567 mr_asprintf( &tmp1, "%s1", bkpinfo->media_device);1568 mr_asprintf(tmp1, "%s1", bkpinfo->media_device); 1568 1569 if (is_this_device_mounted(tmp1)) { 1569 1570 log_msg(1, "USB device mounted. Remounting it at the right place"); 1570 mr_asprintf( &tmp, "umount %s", tmp1);1571 mr_asprintf(tmp, "umount %s", tmp1); 1571 1572 run_program_and_log_output(tmp, FALSE); 1572 1573 paranoid_free(tmp); … … 1575 1576 1576 1577 log_msg(1, "Mounting USB device."); 1577 mr_asprintf( &tmp1, "%s/usb", bkpinfo->tmpdir);1578 mr_asprintf( &tmp, "mkdir -p %s", tmp1);1578 mr_asprintf(tmp1, "%s/usb", bkpinfo->tmpdir); 1579 mr_asprintf(tmp, "mkdir -p %s", tmp1); 1579 1580 run_program_and_log_output(tmp, FALSE); 1580 1581 paranoid_free(tmp); 1581 1582 /* Mindi always create one single parition on the USB dev */ 1582 mr_asprintf( &tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);1583 mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, tmp1); 1583 1584 run_program_and_log_output(tmp, FALSE); 1584 1585 paranoid_free(tmp); … … 1590 1591 1591 1592 /* Command to execute */ 1592 mr_asprintf( &tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1);1593 mr_asprintf(tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1); 1593 1594 res = eval_call_to_make_USB(tmp, message_to_screen); 1594 1595 if (res) { 1595 mr_asprintf( &result_sz, "%s ...failed",tmp);1596 mr_asprintf(result_sz, "%s ...failed",tmp); 1596 1597 } else { 1597 mr_asprintf( &result_sz, "%s ...OK",tmp);1598 mr_asprintf(result_sz, "%s ...OK",tmp); 1598 1599 } 1599 1600 log_to_screen(result_sz); … … 1603 1604 1604 1605 /* Recreate the required structure under the scratch dir */ 1605 mr_asprintf( &tmp,"mkdir %s/archive", bkpinfo->scratchdir);1606 mr_asprintf(tmp,"mkdir %s/archive", bkpinfo->scratchdir); 1606 1607 run_program_and_log_output(tmp, FALSE); 1607 1608 paranoid_free(tmp); … … 1611 1612 1612 1613 if (is_this_device_mounted(bkpinfo->media_device)) { 1613 mr_asprintf( &tmp, "umount %s1", bkpinfo->media_device);1614 mr_asprintf(tmp, "umount %s1", bkpinfo->media_device); 1614 1615 run_program_and_log_output(tmp, FALSE); 1615 1616 paranoid_free(tmp); … … 1665 1666 assert_string_is_neither_NULL_nor_zerolength(destfile); 1666 1667 1667 mr_asprintf( &tmp, "%s/isolinux.bin", bkpinfo->scratchdir);1668 mr_asprintf( &tmp2, "%s/isolinux.bin", bkpinfo->tmpdir);1668 mr_asprintf(tmp, "%s/isolinux.bin", bkpinfo->scratchdir); 1669 mr_asprintf(tmp2, "%s/isolinux.bin", bkpinfo->tmpdir); 1669 1670 if (does_file_exist(tmp)) { 1670 mr_asprintf( &tmp3, "cp -f %s %s", tmp, tmp2);1671 mr_asprintf(tmp3, "cp -f %s %s", tmp, tmp2); 1671 1672 paranoid_system(tmp3); 1672 1673 mr_free(tmp3); 1673 1674 } 1674 1675 if (!does_file_exist(tmp) && does_file_exist(tmp2)) { 1675 mr_asprintf( &tmp3, "cp -f %s %s", tmp2, tmp);1676 mr_asprintf(tmp3, "cp -f %s %s", tmp2, tmp); 1676 1677 paranoid_system(tmp3); 1677 1678 mr_free(tmp3); … … 1686 1687 log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s", bkpinfo->scratchdir, destfile); 1687 1688 (void) getcwd(old_pwd, MAX_STR_LEN - 1); 1688 mr_asprintf( &tmp, "chmod 755 %s", bkpinfo->scratchdir);1689 mr_asprintf(tmp, "chmod 755 %s", bkpinfo->scratchdir); 1689 1690 run_program_and_log_output(tmp, FALSE); 1690 1691 mr_free(tmp); … … 1693 1694 1694 1695 if (bkpinfo->call_before_iso[0] != '\0') { 1695 mr_asprintf( &message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number);1696 mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number); 1696 1697 res = 1697 1698 eval_call_to_make_ISO(bkpinfo->call_before_iso, … … 1712 1713 log_msg(2, "bkpinfo->call_make_iso = %s", bkpinfo->call_make_iso); 1713 1714 mds = media_descriptor_string(bkpinfo->backup_media_type); 1714 mr_asprintf( &message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number);1715 mr_asprintf(message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number); 1715 1716 mr_free(mds); 1716 1717 … … 1726 1727 } else { 1727 1728 log_to_screen("%s...OK", message_to_screen); 1728 mr_asprintf( &tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE);1729 mr_asprintf(tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE); 1729 1730 if (!run_program_and_log_output(tmp, 1)) { 1730 1731 log_to_screen … … 1735 1736 retval += res; 1736 1737 #ifdef DVDRWFORMAT 1737 mr_asprintf( &tmp, "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'", MONDO_LOGFILE);1738 mr_asprintf(tmp, "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'", MONDO_LOGFILE); 1738 1739 if (g_backup_media_type == dvd 1739 1740 && (res || !run_program_and_log_output(tmp, 1))) { … … 1751 1752 } 1752 1753 pause_for_N_seconds(5, "Letting DVD drive settle"); 1753 mr_asprintf( &sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);1754 mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device); 1754 1755 log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk); 1755 1756 res = … … 1802 1803 } else { 1803 1804 mds = media_descriptor_string(bkpinfo->backup_media_type); 1804 mr_asprintf( &message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number);1805 mr_asprintf(message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number); 1805 1806 log_msg(1, message_to_screen); 1806 mr_asprintf( &result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds, g_current_media_number);1807 mr_asprintf(result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds, g_current_media_number); 1807 1808 mr_free(mds); 1808 1809 if (bkpinfo->nonbootable_backup) { … … 1874 1875 "Warning - %s mounted. I'm unmounting it before I burn to it.", 1875 1876 bkpinfo->media_device); 1876 mr_asprintf( &tmp, "umount %s", bkpinfo->media_device);1877 mr_asprintf(tmp, "umount %s", bkpinfo->media_device); 1877 1878 run_program_and_log_output(tmp, FALSE); 1878 1879 mr_free(tmp); … … 1883 1884 log_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso); 1884 1885 mds = media_descriptor_string(bkpinfo->backup_media_type); 1885 mr_asprintf( &message_to_screen, "Burning %s #%d", mds, g_current_media_number);1886 mr_asprintf(message_to_screen, "Burning %s #%d", mds, g_current_media_number); 1886 1887 mr_free(mds); 1887 1888 pause_and_ask_for_cdr(2, &cd_is_mountable); … … 1903 1904 if (bkpinfo->call_after_iso[0] != '\0') { 1904 1905 mds = media_descriptor_string(bkpinfo->backup_media_type); 1905 mr_asprintf( &message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);1906 mr_asprintf(message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number); 1906 1907 mr_free(mds); 1907 1908 res = … … 1936 1937 bool ret = TRUE; 1937 1938 1938 mr_asprintf( &command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname);1939 mr_asprintf(command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname); 1939 1940 log_msg(1, "command = '%s'", command); 1940 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1941 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1941 1942 mr_free(command); 1942 1943 … … 2011 2012 return (0); 2012 2013 } 2013 mr_asprintf( &tmp, "I am now backing up all large files.");2014 mr_asprintf(tmp, "I am now backing up all large files."); 2014 2015 log_to_screen(tmp); 2015 2016 noof_biggie_files = count_lines_in_file(biggielist_fname); … … 2055 2056 "Calling ntfsclone in background because %s is an NTFS partition", 2056 2057 bigfile_fname); 2057 mr_asprintf( &sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));2058 mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768)); 2058 2059 mkfifo(sz_devfile, 0x770); 2059 2060 ntfsprog_fifo = sz_devfile; … … 2109 2110 p = bigfile_fname; 2110 2111 } 2111 mr_asprintf( &tmp, "Archiving %s ... ", bigfile_fname);2112 mr_asprintf(tmp, "Archiving %s ... ", bigfile_fname); 2112 2113 if (res) { 2113 2114 mr_strcat(tmp, "Failed!"); … … 2170 2171 for (; does_file_exist(curr_filelist_fname); curr_set_no++) { 2171 2172 /* backup this set of files */ 2172 mr_asprintf( &curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);2173 mr_asprintf(curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no); 2173 2174 if (! does_file_exist(curr_filelist_fname)) { 2174 2175 mr_free(curr_filelist_fname); … … 2176 2177 } 2177 2178 2178 mr_asprintf( &curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix);2179 mr_asprintf(curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix); 2179 2180 2180 2181 log_msg(1, "EXAT'g set %ld", curr_set_no); 2181 2182 if (g_getfattr) { 2182 mr_asprintf( &curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);2183 mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no); 2183 2184 get_fattr_list(curr_filelist_fname, curr_xattr_list_fname); 2184 2185 } 2185 2186 if (g_getfacl) { 2186 mr_asprintf( &curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);2187 mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no); 2187 2188 get_acl_list(curr_filelist_fname, curr_acl_list_fname); 2188 2189 } … … 2194 2195 retval += res; 2195 2196 if (res) { 2196 mr_asprintf( &tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);2197 mr_asprintf(tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no); 2197 2198 log_to_screen(tmp); 2198 2199 mr_free(tmp); … … 2246 2247 2247 2248 if (res) { 2248 mr_asprintf( &tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);2249 mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no); 2249 2250 log_to_screen(tmp); 2250 2251 mr_free(tmp); … … 2256 2257 } 2257 2258 close_progress_form(); 2258 mr_asprintf( &tmp, "Your regular files have been archived ");2259 mr_asprintf(tmp, "Your regular files have been archived "); 2259 2260 if (retval) { 2260 2261 mr_strcat(tmp, "(with errors)."); … … 2342 2343 mvaddstr_and_log_it(g_currentY, 0, 2343 2344 "Archiving large files to media "); 2344 mr_asprintf( &biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir);2345 mr_asprintf(biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir); 2345 2346 if (g_getfattr) { 2346 mr_asprintf( &xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2347 mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2347 2348 } 2348 2349 if (g_getfacl) { 2349 mr_asprintf( &acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2350 } 2351 2352 mr_asprintf( &command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,2350 mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2351 } 2352 2353 mr_asprintf(command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir, 2353 2354 biggielist); 2354 2355 paranoid_system(command); 2355 2356 mr_free(command); 2356 2357 2357 mr_asprintf( &blah, "biggielist = %s", biggielist);2358 mr_asprintf(blah, "biggielist = %s", biggielist); 2358 2359 log_msg(2, blah); 2359 2360 mr_free(blah); … … 2365 2366 if (g_getfattr) { 2366 2367 get_fattr_list(biggielist, xattr_fname); 2367 mr_asprintf( &command, "cp %s %s/archives/", xattr_fname, bkpinfo->scratchdir);2368 mr_asprintf(command, "cp %s %s/archives/", xattr_fname, bkpinfo->scratchdir); 2368 2369 paranoid_system(command); 2369 2370 mr_free(command); … … 2371 2372 if (g_getfacl) { 2372 2373 get_acl_list(biggielist, acl_fname); 2373 mr_asprintf( &command, "cp %s %s/archives/", acl_fname, bkpinfo->scratchdir);2374 mr_asprintf(command, "cp %s %s/archives/", acl_fname, bkpinfo->scratchdir); 2374 2375 paranoid_system(command); 2375 2376 mr_free(command); … … 2378 2379 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2379 2380 res += write_EXAT_files_to_tape(xattr_fname, acl_fname); 2380 mr_asprintf( &blah, "%ld", count_lines_in_file(biggielist));2381 mr_asprintf(blah, "%ld", count_lines_in_file(biggielist)); 2381 2382 write_header_block_to_stream((off_t)0, blah, BLK_START_BIGGIEFILES); 2382 2383 mr_free(blah); … … 2454 2455 continue; 2455 2456 } 2456 mr_asprintf( &curr_file, "%s", cf);2457 mr_asprintf(curr_file, "%s", cf); 2457 2458 if (!does_file_exist(curr_file)) { 2458 2459 log_msg(1, … … 2483 2484 continue; 2484 2485 } 2485 mr_asprintf( &curr_file, "%s", cf);2486 2487 mr_asprintf( &tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir);2486 mr_asprintf(curr_file, "%s", cf); 2487 2488 mr_asprintf(tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir); 2488 2489 mr_free(curr_file); 2489 2490 res = run_program_and_log_output(tmp, 5); … … 2558 2559 continue; 2559 2560 } 2560 mr_asprintf( &curr_file, "%s", cf);2561 mr_asprintf(curr_file, "%s", cf); 2561 2562 if (!does_file_exist(curr_file)) { 2562 2563 log_msg(1, … … 2616 2617 char *cdrecord = NULL; 2617 2618 2618 mr_asprintf( &bkp, "%s", cdrw_dev);2619 mr_asprintf(bkp, "%s", cdrw_dev); 2619 2620 if (find_cdrw_device(cdrw_dev)) { 2620 2621 strcpy(cdrw_dev, bkp); 2621 2622 } else { 2622 2623 if (!system("which cdrecord > /dev/null 2> /dev/null")) { 2623 mr_asprintf( &cdrecord, "cdrecord dev=%s -atip", cdrw_dev);2624 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev); 2624 2625 } else if (!system("which dvdrecord > /dev/null 2> /dev/null")) { 2625 mr_asprintf( &cdrecord, "cdrecord dev=%s -atip", cdrw_dev);2626 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev); 2626 2627 } else { 2627 2628 log_msg(2, "Oh well. I guess I'll just pray then."); … … 2681 2682 2682 2683 mds = media_descriptor_string(g_backup_media_type); 2683 mr_asprintf( &tmp, "I am about to burn %s #%d", mds, g_current_media_number);2684 mr_asprintf(tmp, "I am about to burn %s #%d", mds, g_current_media_number); 2684 2685 mr_free(mds); 2685 2686 log_to_screen(tmp); … … 2699 2700 retract_CD_tray_and_defeat_autorun(); 2700 2701 */ 2701 mr_asprintf( &tmp, "umount %s", cdrom_dev);2702 mr_asprintf(tmp, "umount %s", cdrom_dev); 2702 2703 run_program_and_log_output(tmp, 1); 2703 2704 sprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt); … … 2705 2706 sprintf(szunmount, "umount %s", mtpt); 2706 2707 cd_number = -1; 2707 mr_asprintf( &tmp, "mount %s %s", cdrom_dev, mtpt);2708 mr_asprintf( &our_serial_str, "%s", "");2708 mr_asprintf(tmp, "mount %s %s", cdrom_dev, mtpt); 2709 mr_asprintf(our_serial_str, "%s", ""); 2709 2710 attempt_to_mount_returned_this = run_program_and_log_output(tmp, 1); 2710 2711 mr_free(tmp); … … 2735 2736 2736 2737 cd_number = atoi(last_line_of_file(szcdno)); 2737 mr_asprintf( &tmp, "cat %s 2> /dev/null", szserfname);2738 mr_asprintf(tmp, "cat %s 2> /dev/null", szserfname); 2738 2739 mr_free(our_serial_str); 2739 mr_asprintf( &our_serial_str, "%s", call_program_and_get_last_line_of_output(tmp));2740 mr_asprintf(our_serial_str, "%s", call_program_and_get_last_line_of_output(tmp)); 2740 2741 mr_free(tmp); 2741 2742 // FIXME - should be able to use last_line_of_file(), surely? … … 2773 2774 eject_device(cdrom_dev); 2774 2775 mds = media_descriptor_string(g_backup_media_type); 2775 mr_asprintf( &tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", mds, g_current_media_number, mds);2776 mr_asprintf(tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", mds, g_current_media_number, mds); 2776 2777 mr_free(mds); 2777 2778 … … 2918 2919 if (is_this_file_compressed(biggie_filename) 2919 2920 || bkpinfo->compression_level == 0) { 2920 mr_asprintf( &suffix, "%s", "");2921 mr_asprintf(suffix, "%s", ""); 2921 2922 // log_it("%s is indeed compressed :-)", filename); 2922 2923 should_I_compress_slices = FALSE; 2923 2924 } else { 2924 mr_asprintf( &suffix, "%s", bkpinfo->zip_suffix);2925 mr_asprintf(suffix, "%s", bkpinfo->zip_suffix); 2925 2926 should_I_compress_slices = TRUE; 2926 2927 } … … 2938 2939 fatal_error("ntfsresize not found"); 2939 2940 } 2940 mr_asprintf( &command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);2941 mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename); 2941 2942 log_it("command = %s", command); 2942 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));2943 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 2943 2944 mr_free(command); 2944 2945 log_it("res of it = %s", tmp); … … 2948 2949 file_to_openin = biggie_filename; 2949 2950 if (strchr(biggie_filename,'\'') != NULL) { 2950 mr_asprintf( &command, "md5sum \"%s\"", biggie_filename);2951 mr_asprintf(command, "md5sum \"%s\"", biggie_filename); 2951 2952 } else { 2952 mr_asprintf( &command, "md5sum '%s'", biggie_filename);2953 mr_asprintf(command, "md5sum '%s'", biggie_filename); 2953 2954 } 2954 2955 if (!(fin = popen(command, "r"))) { … … 2973 2974 strcpy(biggiestruct.checksum, checksum_line); 2974 2975 2975 mr_asprintf( &tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));2976 mr_asprintf(tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, "")); 2976 2977 fout = fopen(tmp, "w"); 2977 2978 if (fout == NULL) { … … 2992 2993 if (!(fin = fopen(file_to_openin, "r"))) { 2993 2994 log_OS_error("Unable to openin biggie_filename"); 2994 mr_asprintf( &tmp, "Cannot archive bigfile '%s': not found", biggie_filename);2995 mr_asprintf(tmp, "Cannot archive bigfile '%s': not found", biggie_filename); 2995 2996 log_to_screen(tmp); 2996 2997 paranoid_free(tmp); … … 3014 3015 } 3015 3016 for (slice_num = 1; !finished; slice_num++) { 3016 mr_asprintf( &curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));3017 mr_asprintf( &curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));3017 mr_asprintf(curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, "")); 3018 mr_asprintf(curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix)); 3018 3019 3019 3020 … … 3050 3051 } 3051 3052 if (should_I_compress_slices && bkpinfo->compression_level > 0) { 3052 mr_asprintf( &command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed);3053 mr_asprintf(command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed); 3053 3054 log_msg(2, command); 3054 3055 if ((res = system(command))) { … … 3057 3058 // did_I_compress_slice = TRUE; 3058 3059 } else { 3059 mr_asprintf( &command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE);3060 mr_asprintf(command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE); 3060 3061 res = 0; // don't do it :) 3061 3062 // did_I_compress_slice = FALSE; … … 3073 3074 } 3074 3075 if (res) { 3075 mr_asprintf( &tmp, "Problem with slice # %ld", slice_num);3076 mr_asprintf(tmp, "Problem with slice # %ld", slice_num); 3076 3077 } else { 3077 mr_asprintf( &tmp, "%s - Bigfile #%ld, slice #%ld compressed OK ", biggie_filename, biggie_file_number + 1, slice_num);3078 mr_asprintf(tmp, "%s - Bigfile #%ld, slice #%ld compressed OK ", biggie_filename, biggie_file_number + 1, slice_num); 3078 3079 } 3079 3080 #ifndef _XWIN … … 3089 3090 paranoid_free(tmp); 3090 3091 3091 mr_asprintf( &file_to_archive, "%s", curr_slice_fname_compressed);3092 mr_asprintf(file_to_archive, "%s", curr_slice_fname_compressed); 3092 3093 g_current_progress++; 3093 3094 } else { /* if i==0 then ... */ 3094 3095 3095 3096 finished = TRUE; 3096 mr_asprintf( &file_to_archive, "%s", curr_slice_fname_uncompressed);3097 mr_asprintf(file_to_archive, "%s", curr_slice_fname_uncompressed); 3097 3098 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 3098 3099 break; … … 3114 3115 retval += res; 3115 3116 if (res) { 3116 mr_asprintf( &tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);3117 mr_asprintf(tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1); 3117 3118 log_to_screen(tmp); 3118 3119 paranoid_free(tmp); … … 3124 3125 mr_free(suffix); 3125 3126 paranoid_fclose(fin); 3126 mr_asprintf( &tmp, "Sliced bigfile #%ld", biggie_file_number + 1);3127 mr_asprintf(tmp, "Sliced bigfile #%ld", biggie_file_number + 1); 3127 3128 if (retval) { 3128 3129 mr_strcat(tmp, "...FAILED"); … … 3158 3159 assert_string_is_neither_NULL_nor_zerolength(d); 3159 3160 3160 mr_asprintf( &dir, "%s/archives", d);3161 mr_asprintf( &tmp, "find %s -name '*.afio*' -exec rm -f '{}' \\;", dir);3161 mr_asprintf(dir, "%s/archives", d); 3162 mr_asprintf(tmp, "find %s -name '*.afio*' -exec rm -f '{}' \\;", dir); 3162 3163 run_program_and_log_output(tmp, FALSE); 3163 3164 mr_free(tmp); 3164 mr_asprintf( &tmp, "find %s -name '*list.[0-9]*' -exec rm -f '{}' \\;", dir);3165 mr_asprintf(tmp, "find %s -name '*list.[0-9]*' -exec rm -f '{}' \\;", dir); 3165 3166 run_program_and_log_output(tmp, FALSE); 3166 3167 mr_free(tmp); 3167 mr_asprintf( &tmp, "find %s -name 'slice*' -exec rm -f '{}' \\;", dir);3168 mr_asprintf(tmp, "find %s -name 'slice*' -exec rm -f '{}' \\;", dir); 3168 3169 run_program_and_log_output(tmp, FALSE); 3169 3170 mr_free(tmp); 3170 mr_asprintf( &tmp, "rm -f %s/cklist*", dir);3171 mr_asprintf(tmp, "rm -f %s/cklist*", dir); 3171 3172 run_program_and_log_output(tmp, FALSE); 3172 3173 mr_free(tmp); 3173 mr_asprintf( &tmp, "rm -f %s/zero", dir);3174 mr_asprintf(tmp, "rm -f %s/zero", dir); 3174 3175 run_program_and_log_output(tmp, FALSE); 3175 3176 mr_free(tmp); 3176 3177 log_msg(1, "Wiped %s's archives", dir); 3177 mr_asprintf( &tmp, "ls -l %s", dir);3178 mr_asprintf(tmp, "ls -l %s", dir); 3178 3179 mr_free(dir); 3179 3180 run_program_and_log_output(tmp, FALSE); … … 3280 3281 /* label the ISO with its number */ 3281 3282 3282 mr_asprintf( &cdno_fname, "%s/archives/THIS-CD-NUMBER", bkpinfo->scratchdir);3283 mr_asprintf(cdno_fname, "%s/archives/THIS-CD-NUMBER", bkpinfo->scratchdir); 3283 3284 fout = fopen(cdno_fname, "w"); 3284 3285 mr_free(cdno_fname); … … 3287 3288 paranoid_fclose(fout); 3288 3289 3289 mr_asprintf( &tmp1, "cp -f %s/autorun %s/", g_mondo_home, bkpinfo->scratchdir);3290 mr_asprintf(tmp1, "cp -f %s/autorun %s/", g_mondo_home, bkpinfo->scratchdir); 3290 3291 if (run_program_and_log_output(tmp1, FALSE)) { 3291 3292 log_msg(2, "Warning - unable to copy autorun to scratchdir"); … … 3294 3295 3295 3296 /* last CD or not? Label accordingly */ 3296 mr_asprintf( &lastcd_fname, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);3297 mr_asprintf(lastcd_fname, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir); 3297 3298 if (last_cd) { 3298 3299 unlink(lastcd_fname); … … 3309 3310 if (space_occupied_by_cd(bkpinfo->scratchdir) / 1024 > 3310 3311 bkpinfo->media_size[g_current_media_number]) { 3311 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), 3312 (long) 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 3313 log_to_screen(tmp1); 3314 3314 mr_free(tmp1); 3315 3315 } 3316 mr_asprintf( &isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);3316 mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number); 3317 3317 for (that_one_was_ok = FALSE; !that_one_was_ok;) { 3318 3318 if (bkpinfo->backup_media_type != usb) { … … 3351 3351 } else { 3352 3352 mds = media_descriptor_string(bkpinfo->backup_media_type); 3353 mr_asprintf( &tmp1, "Failed to create %s #%d. Retry?", mds, g_current_media_number);3353 mr_asprintf(tmp1, "Failed to create %s #%d. Retry?", mds, g_current_media_number); 3354 3354 mr_free(mds); 3355 3355 res = ask_me_yes_or_no(tmp1); … … 3375 3375 } 3376 3376 wipe_archives(bkpinfo->scratchdir); 3377 mr_asprintf( &tmp1, "rm -Rf %s/images/*gz %s/images/*data*img", bkpinfo->scratchdir, bkpinfo->scratchdir);3377 mr_asprintf(tmp1, "rm -Rf %s/images/*gz %s/images/*data*img", bkpinfo->scratchdir, bkpinfo->scratchdir); 3378 3378 if (system(tmp1)) { 3379 3379 log_msg … … 3432 3432 log_msg(2, 3433 3433 "Not verifying again. Per-CD/ISO verification already carried out."); 3434 mr_asprintf( &tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MONDO_CACHE);3434 mr_asprintf(tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MONDO_CACHE); 3435 3435 paranoid_system(tmp); 3436 3436 mr_free(tmp); … … 3455 3455 if (res) { 3456 3456 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);3457 mr_asprintf(tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number); 3458 3458 mr_free(mds); 3459 3459 log_to_screen(tmp); … … 3462 3462 } 3463 3463 } 3464 mr_asprintf( &tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);3464 mr_asprintf(tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE); 3465 3465 (void)system(tmp); 3466 3466 mr_free(tmp); 3467 3467 3468 mr_asprintf( &tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);3468 mr_asprintf(tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE); 3469 3469 (void)system(tmp); 3470 3470 mr_free(tmp); … … 3475 3475 //} 3476 3476 } 3477 mr_asprintf( &tmp, "%s/changed.files", MONDO_CACHE);3477 mr_asprintf(tmp, "%s/changed.files", MONDO_CACHE); 3478 3478 diffs = count_lines_in_file(tmp); 3479 3479 mr_free(tmp);
Note:
See TracChangeset
for help on using the changeset viewer.