Changeset 2323 in MondoRescue
- Timestamp:
- Aug 18, 2009, 3:05:43 PM (15 years ago)
- Location:
- branches/2.2.10/mondo
- Files:
-
- 25 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); -
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2322 r2323 111 111 for (i = 0; i < 128; i++) { 112 112 if (flag_set[i]) { 113 mr_asprintf( &tmp, "-%c %s", i, flag_val[i]);113 mr_asprintf(tmp, "-%c %s", i, flag_val[i]); 114 114 log_msg(3, tmp); 115 115 mr_free(tmp); 116 116 } 117 117 } 118 mr_asprintf( &tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir);118 mr_asprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir); 119 119 paranoid_system(tmp); 120 120 mr_free(tmp); 121 121 122 mr_asprintf( &tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir);122 mr_asprintf(tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir); 123 123 paranoid_system(tmp); 124 124 mr_free(tmp); … … 126 126 mr_strcat(bkpinfo->scratchdir, "/mondo.scratch.%ld", random() % 32767); 127 127 128 mr_asprintf( &tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);128 mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); 129 129 paranoid_system(tmp); 130 130 mr_free(tmp); 131 131 132 mr_asprintf( &tmp, "mkdir -p %s", bkpinfo->scratchdir);132 mr_asprintf(tmp, "mkdir -p %s", bkpinfo->scratchdir); 133 133 paranoid_system(tmp); 134 134 mr_free(tmp); … … 161 161 *(strchr(tmp, ',')) = '\0'; 162 162 bkpinfo->media_size[j] = friendly_sizestr_to_sizelong(tmp); 163 mr_asprintf( &comment, "media_size[%d] = %ld", j, bkpinfo->media_size[j]);163 mr_asprintf(comment, "media_size[%d] = %ld", j, bkpinfo->media_size[j]); 164 164 log_msg(3, comment); 165 165 mr_free(comment); … … 279 279 ********/ 280 280 /* Get the number of mounted file systems ((those that start with "/dev/" */ 281 mr_asprintf( &command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");281 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l"); 282 282 log_msg(5, "Running: %s", command); 283 mr_asprintf( &mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));283 mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command)); 284 284 mr_free(command); 285 285 … … 289 289 290 290 for (i=mount_cnt; i > 0; i--) { 291 mr_asprintf( &command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);291 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i); 292 292 log_msg(5, "Running: %s", command); 293 mr_asprintf( &mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));293 mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command)); 294 294 mr_free(command); 295 295 … … 373 373 log_msg(5, " %s looks like a device special file", dsf); 374 374 /* Verify that the dsf exists */ 375 mr_asprintf( &command, "ls -al %s 2>/dev/null | wc -l", dsf);375 mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf); 376 376 log_msg(5, " Executing: %s", command); 377 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));377 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 378 378 mr_free(command); 379 379 … … 399 399 * Either way, it's an error. 400 400 ********/ 401 mr_asprintf( &command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);401 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf); 402 402 log_msg(4, "Executing: %s", command); 403 mr_asprintf( &partition_list, "%s", call_program_and_get_last_line_of_output(command));403 mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command)); 404 404 mr_free(command); 405 405 log_msg(4, "Partition list for %s: %s", dsf, partition_list); … … 452 452 log_msg(4, "Processing partition: %s", partitions[i]); 453 453 /* See if it's swap. If it is, ignore it. */ 454 mr_asprintf( &command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",454 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", 455 455 dsf, partitions[i]); 456 456 log_msg(4, " Running: %s", command); 457 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));457 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 458 458 mr_free(command); 459 459 … … 467 467 } 468 468 /* It's not swap. See if we can find the mount point from the mount command. */ 469 mr_asprintf( &command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);470 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));469 mr_asprintf(command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]); 470 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 471 471 mr_free(command); 472 472 … … 486 486 log_msg(4, " It's not mounted. Checking to see if it's LVM..."); 487 487 /* Get the partition ID; 8e for LVM */ 488 mr_asprintf( &command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", dsf, partitions[i]);488 mr_asprintf(command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", dsf, partitions[i]); 489 489 log_msg(4, " Running: %s", command); 490 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));490 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 491 491 mr_free(command); 492 492 if (strlen(tmp)) { … … 495 495 /* It's LVM: Find the VG it's in */ 496 496 log_msg(4, " It's LVM: Find the VG it's in..."); 497 mr_asprintf( &command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);497 mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]); 498 498 log_msg(4, " Running: %s", command); 499 499 strcpy(VG, call_program_and_get_last_line_of_output(command)); … … 503 503 /* Found the Volume Group. Now find all of the VG's mount points */ 504 504 log_msg(4, " Found the Volume Group. Now find all of the VG's mount points"); 505 mr_asprintf( &command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);505 mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG); 506 506 log_msg(4, " Running: %s", command); 507 mr_asprintf( &mount_list, "%s", call_program_and_get_last_line_of_output(command));507 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command)); 508 508 mr_free(command); 509 509 log_msg(4, " VG %s mount_list: %s", VG, mount_list); … … 525 525 *******/ 526 526 mr_free(mount_list); 527 mr_asprintf( &command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");527 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 528 528 log_msg (5, "Running: %s", command); 529 mr_asprintf( &mount_list, "%s", call_program_and_get_last_line_of_output(command));529 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command)); 530 530 mr_free(command); 531 531 log_msg(4, " Software raid device list: %s", mount_list); 532 532 lastpos = 0; 533 533 while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) { 534 mr_asprintf( &command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);534 mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG); 535 535 log_msg (5, "Running: %s", command); 536 536 mr_free(tmp); 537 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));537 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 538 538 mr_free(command); 539 539 log_msg(4, "Number of Software raid device: %s", tmp); … … 567 567 ********/ 568 568 log_msg (5, "It's not swap, mounted, or LVM. See if it's used in a software raid device."); 569 mr_asprintf( &command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);569 mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]); 570 570 log_msg(4, " Running: %s", command); 571 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));571 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 572 572 mr_free(command); 573 573 if (!strlen(tmp)) { … … 578 578 log_msg (5, " UUID: %s", tmp); 579 579 /* Get the Software raid device list */ 580 mr_asprintf( &command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");580 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 581 581 log_msg (5, " Running: %s", command); 582 mr_asprintf( &mount_list, "%s", call_program_and_get_last_line_of_output(command));582 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command)); 583 583 mr_free(command); 584 584 log_msg(4, " Software raid device list: %s", mount_list); … … 586 586 lastpos = 0; 587 587 while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) { 588 mr_asprintf( &command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);588 mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp); 589 589 log_msg(4, " Running: %s", command); 590 590 mr_free(tmp); 591 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));591 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 592 592 mr_free(command); 593 593 if (!atoi(tmp)) { … … 760 760 } 761 761 762 mr_asprintf( &tmp1, "%s", flag_val['I']);762 mr_asprintf(tmp1, "%s", flag_val['I']); 763 763 p = tmp1; 764 764 q = tmp1; … … 797 797 log_to_screen("Archiving only the following file systems on %s:\n", token); 798 798 log_to_screen(" %s\n", mounted_on_dsf); 799 mr_asprintf( &p, "/");799 mr_asprintf(p, "/"); 800 800 mr_free(bkpinfo->include_paths); 801 801 bkpinfo->include_paths = p; … … 837 837 } 838 838 bkpinfo->make_filelist = FALSE; 839 mr_asprintf( &p, "%s", flag_val['J']);839 mr_asprintf(p, "%s", flag_val['J']); 840 840 mr_free(bkpinfo->include_paths); 841 841 bkpinfo->include_paths = p; … … 903 903 strcpy(flag_val['d'], p); 904 904 mr_free(p); 905 mr_asprintf( &tmp1, "You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']);905 mr_asprintf(tmp1, "You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']); 906 906 log_to_screen(tmp1); 907 907 mr_free(tmp1); … … 954 954 } 955 955 } 956 /*957 if (flag_set['Z']) {958 bkpinfo->blank_dvd_first = TRUE;959 }960 */961 956 } 962 957 … … 1009 1004 p--; 1010 1005 *p = '\0'; 1011 mr_asprintf( &q,"%s",bkpinfo->nfs_mount);1006 mr_asprintf(q,"%s",bkpinfo->nfs_mount); 1012 1007 bkpinfo->nfs_user = q; 1013 1008 strcpy(bkpinfo->nfs_mount,tmp); 1014 1009 } 1015 mr_asprintf(&tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", 1016 bkpinfo->nfs_mount); 1017 strncpy(bkpinfo->isodir, 1018 call_program_and_get_last_line_of_output(tmp1), 1019 MAX_STR_LEN / 4); 1010 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount); 1011 mr_free(bkpinfo->isodir); 1012 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1)); 1013 bkpinfo->isodir = tmp2; 1020 1014 mr_free(tmp1); 1021 1015 1022 1016 if (strlen(bkpinfo->isodir) < 3) { 1023 1017 log_to_screen("NFS share is not mounted. Trying to mount it for you.\n"); 1024 mr_asprintf( &tmp1, "mount %s", bkpinfo->nfs_mount);1018 mr_asprintf(tmp1, "mount %s", bkpinfo->nfs_mount); 1025 1019 i = system(tmp1); 1026 1020 mr_free(tmp1); … … 1029 1023 retval++; 1030 1024 } else { 1031 mr_asprintf( &tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);1032 strncpy(bkpinfo->isodir,1033 call_program_and_get_last_line_of_output(tmp1),1034 MAX_STR_LEN / 4);1025 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount); 1026 mr_free(bkpinfo->isodir); 1027 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1)); 1028 bkpinfo->isodir = tmp2; 1035 1029 mr_free(tmp1); 1036 1030 … … 1078 1072 if (flag_set['z']) { 1079 1073 if (find_home_of_exe("getfattr")) { 1080 mr_asprintf( &g_getfattr,"getfattr");1074 mr_asprintf(g_getfattr,"getfattr"); 1081 1075 } 1082 1076 if (find_home_of_exe("getfacl")) { 1083 mr_asprintf( &g_getfacl,"getfacl");1077 mr_asprintf(g_getfacl,"getfacl"); 1084 1078 } 1085 1079 } … … 1095 1089 log_to_screen("Please supply a sensible value with '-E'\n"); 1096 1090 } 1097 mr_asprintf( &tmp1, "%s", flag_val['E']);1091 mr_asprintf(tmp1, "%s", flag_val['E']); 1098 1092 1099 1093 p = tmp1; … … 1163 1157 if ((flag_set['N']) && (! bkpinfo->restore_data)) // exclude NFS mounts & devices 1164 1158 { 1165 mr_asprintf( &psz, "%s", list_of_NFS_mounts_only());1159 mr_asprintf(psz, "%s", list_of_NFS_mounts_only()); 1166 1160 mr_strcat(bkpinfo->exclude_paths, " %s ", psz); 1167 1161 mr_free(psz); … … 1173 1167 1174 1168 if (flag_set['b']) { 1175 mr_asprintf( &psz, "%s", flag_val['b']);1169 mr_asprintf(psz, "%s", flag_val['b']); 1176 1170 log_msg(1, "psz = '%s'", psz); 1177 1171 if (psz[strlen(psz) - 1] == 'k') { … … 1219 1213 && !does_file_exist(bkpinfo->kernel_path)) { 1220 1214 retval++; 1221 mr_asprintf( &tmp1, "You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path);1215 mr_asprintf(tmp1, "You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path); 1222 1216 log_to_screen(tmp1); 1223 1217 mr_free(tmp1); … … 1227 1221 if (flag_set['p']) { 1228 1222 mr_free(bkpinfo->prefix); 1229 mr_asprintf( &tmp1, "%s", flag_val['p']);1223 mr_asprintf(tmp1, "%s", flag_val['p']); 1230 1224 bkpinfo->prefix = tmp1; 1231 1225 log_msg(1,"Prefix forced to %s",bkpinfo->prefix); … … 1234 1228 if (flag_set['d']) { /* backup directory (if ISO/NFS) */ 1235 1229 if (flag_set['i']) { 1236 strncpy(bkpinfo->isodir, flag_val['d'], MAX_STR_LEN / 4); 1237 mr_asprintf(&tmp1, "ls -l %s", bkpinfo->isodir); 1230 mr_free(bkpinfo->isodir); 1231 mr_asprintf(tmp2, "%s", flag_val['d']); 1232 bkpinfo->isodir = tmp2; 1233 mr_asprintf(tmp1, "ls -l %s", bkpinfo->isodir); 1238 1234 if (run_program_and_log_output(tmp1, 2)) { 1239 1235 mr_free(tmp1); 1240 fatal_error 1241 ("output folder does not exist - please create it"); 1236 fatal_error("output folder does not exist - please create it"); 1242 1237 } 1243 1238 mr_free(tmp1); … … 1250 1245 1251 1246 if ((flag_set['n']) && (! bkpinfo->restore_data)) { 1252 mr_asprintf( &tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir);1247 mr_asprintf(tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir); 1253 1248 if (bkpinfo->nfs_user) { 1254 mr_asprintf( &tmp2, "su - %s -c \"echo hi > %s\"", bkpinfo->nfs_user, tmp1);1249 mr_asprintf(tmp2, "su - %s -c \"echo hi > %s\"", bkpinfo->nfs_user, tmp1); 1255 1250 } else { 1256 mr_asprintf( &tmp2, "echo hi > %s", tmp1);1251 mr_asprintf(tmp2, "echo hi > %s", tmp1); 1257 1252 } 1258 1253 i = run_program_and_log_output(tmp2, 2); … … 1261 1256 if (i) { 1262 1257 retval++; 1263 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);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); 1264 1259 log_to_screen(tmp2); 1265 1260 mr_free(tmp2); … … 1302 1297 1303 1298 if (flag_set['S']) { 1304 mr_asprintf( &tmp1, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768);1299 mr_asprintf(tmp1, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768); 1305 1300 mr_free(bkpinfo->scratchdir); 1306 1301 bkpinfo->scratchdir = tmp1; … … 1309 1304 if (flag_set['T']) { 1310 1305 setup_tmpdir(flag_val['T']); 1311 mr_asprintf( &tmp1, "touch %s/.foo.dat", bkpinfo->tmpdir);1306 mr_asprintf(tmp1, "touch %s/.foo.dat", bkpinfo->tmpdir); 1312 1307 i = run_program_and_log_output(tmp1, 1); 1313 1308 mr_free(tmp1); … … 1318 1313 fatal_error("I cannot write to the tempdir you specified."); 1319 1314 } 1320 mr_asprintf( &tmp1, "ln -sf %s/.foo.dat %s/.bar.dat", bkpinfo->tmpdir, bkpinfo->tmpdir);1315 mr_asprintf(tmp1, "ln -sf %s/.foo.dat %s/.bar.dat", bkpinfo->tmpdir, bkpinfo->tmpdir); 1321 1316 i = run_program_and_log_output(tmp1, 1); 1322 1317 mr_free(tmp1); … … 1515 1510 if (flag_set[opt]) { 1516 1511 bad_switches = TRUE; 1517 mr_asprintf( &tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);1512 mr_asprintf(tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]); 1518 1513 log_to_screen(tmp); 1519 1514 mr_free(tmp); … … 1531 1526 if (strchr(flag_val[opt], '/') 1532 1527 && flag_val[opt][0] != '/') { 1533 mr_asprintf( &tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);1528 mr_asprintf(tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]); 1534 1529 log_to_screen(tmp); 1535 1530 mr_free(tmp); … … 1544 1539 for (i = optind; i < argc; i++) { 1545 1540 bad_switches = TRUE; 1546 mr_asprintf( &tmp, "Invalid arg -- %s\n", argv[i]);1541 mr_asprintf(tmp, "Invalid arg -- %s\n", argv[i]); 1547 1542 log_to_screen(tmp); 1548 1543 mr_free(tmp); … … 1575 1570 switch (sig) { 1576 1571 case SIGINT: 1577 mr_asprintf( &tmp, "SIGINT");1578 mr_asprintf( &tmp2, "You interrupted me :-)");1572 mr_asprintf(tmp, "SIGINT"); 1573 mr_asprintf(tmp2, "You interrupted me :-)"); 1579 1574 break; 1580 1575 case SIGKILL: 1581 mr_asprintf( &tmp, "SIGKILL");1582 mr_asprintf( &tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system.");1576 mr_asprintf(tmp, "SIGKILL"); 1577 mr_asprintf(tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system."); 1583 1578 break; 1584 1579 case SIGTERM: 1585 mr_asprintf( &tmp, "SIGTERM");1586 mr_asprintf( &tmp2, "Got terminate signal");1580 mr_asprintf(tmp, "SIGTERM"); 1581 mr_asprintf(tmp2, "Got terminate signal"); 1587 1582 break; 1588 1583 case SIGHUP: 1589 mr_asprintf( &tmp, "SIGHUP");1590 mr_asprintf( &tmp2, "Hangup on line");1584 mr_asprintf(tmp, "SIGHUP"); 1585 mr_asprintf(tmp2, "Hangup on line"); 1591 1586 break; 1592 1587 case SIGSEGV: 1593 mr_asprintf( &tmp, "SIGSEGV");1594 mr_asprintf( &tmp2, "Internal programming error. Please send a backtrace as well as your log.");1588 mr_asprintf(tmp, "SIGSEGV"); 1589 mr_asprintf(tmp2, "Internal programming error. Please send a backtrace as well as your log."); 1595 1590 break; 1596 1591 case SIGPIPE: 1597 mr_asprintf( &tmp, "SIGPIPE");1598 mr_asprintf( &tmp2, "Pipe was broken");1592 mr_asprintf(tmp, "SIGPIPE"); 1593 mr_asprintf(tmp2, "Pipe was broken"); 1599 1594 break; 1600 1595 case SIGABRT: 1601 mr_asprintf( &tmp, "SIGABRT");1602 mr_asprintf( &tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");1596 mr_asprintf(tmp, "SIGABRT"); 1597 mr_asprintf(tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message."); 1603 1598 break; 1604 1599 default: 1605 mr_asprintf( &tmp, "(Unknown)");1606 mr_asprintf( &tmp2, "(Unknown)");1600 mr_asprintf(tmp, "(Unknown)"); 1601 mr_asprintf(tmp2, "(Unknown)"); 1607 1602 } 1608 1603 -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2322 r2323 111 111 bool is_this_a_ramdisk = FALSE; 112 112 113 mr_asprintf( &tmp, "%s", where_is_root_mounted());114 mr_asprintf( &comment, "root is currently mounted at %s\n", tmp);113 mr_asprintf(tmp, "%s", where_is_root_mounted()); 114 mr_asprintf(comment, "root is currently mounted at %s\n", tmp); 115 115 log_msg(0, comment); 116 116 mr_free(comment); … … 210 210 if (IS_THIS_A_STREAMING_BACKUP(g_backup_media_type) 211 211 && g_backup_media_type != udev) { 212 mr_asprintf( &command, "mt -f %s offline", dev);212 mr_asprintf(command, "mt -f %s offline", dev); 213 213 res1 = run_program_and_log_output(command, 1); 214 214 mr_free(command); … … 219 219 #ifdef __FreeBSD__ 220 220 if (strstr(dev, "acd")) { 221 mr_asprintf( &command, "cdcontrol -f %s eject", dev);221 mr_asprintf(command, "cdcontrol -f %s eject", dev); 222 222 } else { 223 mr_asprintf( &command, "camcontrol eject `echo %s | sed 's|/dev/||'`",223 mr_asprintf(command, "camcontrol eject `echo %s | sed 's|/dev/||'`", 224 224 dev); 225 225 } 226 226 #else 227 mr_asprintf( &command, "eject %s", dev);227 mr_asprintf(command, "eject %s", dev); 228 228 #endif 229 229 … … 250 250 #ifdef __FreeBSD__ 251 251 if (strstr(dev, "acd")) { 252 mr_asprintf( &command, "cdcontrol -f %s close", dev);252 mr_asprintf(command, "cdcontrol -f %s close", dev); 253 253 } else { 254 mr_asprintf( &command, "camcontrol load `echo %s | sed 's|/dev/||'`", dev);254 mr_asprintf(command, "camcontrol load `echo %s | sed 's|/dev/||'`", dev); 255 255 } 256 256 #else 257 mr_asprintf( &command, "eject -t %s", dev);257 mr_asprintf(command, "eject -t %s", dev); 258 258 #endif 259 259 i = run_program_and_log_output(command, FALSE); … … 277 277 assert_string_is_neither_NULL_nor_zerolength(device); 278 278 279 mr_asprintf( &tmp, "ls %s > /dev/null 2> /dev/null", device);279 mr_asprintf(tmp, "ls %s > /dev/null 2> /dev/null", device); 280 280 281 281 if (system(tmp)) { … … 336 336 // We assume here that this is running from mondorestore. (It is.) 337 337 tmp = build_partition_name(drive, partno); 338 mr_asprintf( &program, "ls %s %s >/dev/null 2>&1", drive, tmp);338 mr_asprintf(program, "ls %s %s >/dev/null 2>&1", drive, tmp); 339 339 mr_free(tmp); 340 340 … … 347 347 #endif 348 348 349 mr_asprintf( &program, "parted2fdisk -l %s 2> /dev/null", drive);349 mr_asprintf(program, "parted2fdisk -l %s 2> /dev/null", drive); 350 350 fin = popen(program, "r"); 351 351 if (!fin) { … … 394 394 assert_string_is_neither_NULL_nor_zerolength(str); 395 395 396 mr_asprintf( &command, "dd if=%s bs=446 count=1 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, str);396 mr_asprintf(command, "dd if=%s bs=446 count=1 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, str); 397 397 i = system(command); 398 398 mr_free(command); … … 418 418 int i; 419 419 420 mr_asprintf( &command, "dd if=%s bs=512 count=%i 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, n, str);420 mr_asprintf(command, "dd if=%s bs=512 count=%i 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, n, str); 421 421 i = system(command); 422 422 mr_free(command); … … 517 517 run_program_and_log_output("insmod ide-scsi", -1); 518 518 if (find_home_of_exe("cdrecord")) { 519 mr_asprintf( &cdr_exe, "cdrecord");519 mr_asprintf(cdr_exe, "cdrecord"); 520 520 } else { 521 mr_asprintf( &cdr_exe, "dvdrecord");521 mr_asprintf(cdr_exe, "dvdrecord"); 522 522 } 523 523 if (find_home_of_exe(cdr_exe)) { 524 mr_asprintf( &command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", cdr_exe);525 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));524 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", cdr_exe); 525 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 526 526 mr_free(command); 527 527 } … … 532 532 } else { 533 533 strcpy(cdrw_device, tmp); 534 mr_asprintf( &comment, "Found CDRW device - %s", cdrw_device);534 mr_asprintf(comment, "Found CDRW device - %s", cdrw_device); 535 535 log_it(comment); 536 536 strcpy(g_cdrw_drive_is_here, cdrw_device); … … 586 586 phrase_two[0] = '\0'; 587 587 #ifndef __FreeBSD__ 588 mr_asprintf( &dvd_last_resort, "%s", "");;588 mr_asprintf(dvd_last_resort, "%s", "");; 589 589 #endif 590 590 … … 606 606 } 607 607 608 mr_asprintf( &mountpoint, "%s/cd.mnt", bkpinfo->tmpdir);608 mr_asprintf(mountpoint, "%s/cd.mnt", bkpinfo->tmpdir); 609 609 make_hole_for_dir(mountpoint); 610 610 611 611 if (find_home_of_exe("cdrecord")) { 612 mr_asprintf( &cdr_exe, "cdrecord");612 mr_asprintf(cdr_exe, "cdrecord"); 613 613 } else { 614 mr_asprintf( &cdr_exe, "dvdrecord");614 mr_asprintf(cdr_exe, "dvdrecord"); 615 615 } 616 616 tmp[0] = '\0'; … … 628 628 } 629 629 630 mr_asprintf( &command, "%s -scanbus 2> /dev/null", cdr_exe);630 mr_asprintf(command, "%s -scanbus 2> /dev/null", cdr_exe); 631 631 fin = popen(command, "r"); 632 632 log_msg(4, "command=%s", command); … … 668 668 log_msg(4, "Not running phase two. String is empty."); 669 669 } else { 670 mr_asprintf( &command, "dmesg | grep \"%s\" 2> /dev/null", phrase_two);670 mr_asprintf(command, "dmesg | grep \"%s\" 2> /dev/null", phrase_two); 671 671 fin = popen(command, "r"); 672 672 mr_free(command); … … 684 684 if (strstr(tmp, "DVD")) { 685 685 mr_free(dvd_last_resort); 686 mr_asprintf( &dvd_last_resort, "/dev/%s", tmp);686 mr_asprintf(dvd_last_resort, "/dev/%s", tmp); 687 687 log_msg(4, 688 688 "Ignoring '%s' because it's a DVD drive", … … 815 815 found_it = FALSE; 816 816 } else { 817 mr_asprintf( &command, "umount %s", output);817 mr_asprintf(command, "umount %s", output); 818 818 paranoid_system(command); 819 819 mr_free(command); … … 838 838 } 839 839 840 mr_asprintf( &command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cdrw_drive_is_here);840 mr_asprintf(command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cdrw_drive_is_here); 841 841 log_msg(1, "command=%s", command); 842 mr_asprintf( &tmp1, "%s", call_program_and_get_last_line_of_output(command));842 mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output(command)); 843 843 mr_free(command); 844 844 … … 876 876 } 877 877 878 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output878 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output 879 879 ("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1") 880 880 ); … … 882 882 if (!tmp[0]) 883 883 mr_free(tmp); 884 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output884 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output 885 885 ("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1") 886 886 ); … … 1026 1026 assert_string_is_neither_NULL_nor_zerolength(format); 1027 1027 1028 mr_asprintf( &format_sz, "%s ", format);1028 mr_asprintf(format_sz, "%s ", format); 1029 1029 1030 1030 #ifdef __FreeBSD__ 1031 mr_asprintf( &command, "lsvfs | tr -s '\t' ' ' | grep -v Filesys | grep -v -- -- | cut -d' ' -f1 | tr -s '\n' ' '");1031 mr_asprintf(command, "lsvfs | tr -s '\t' ' ' | grep -v Filesys | grep -v -- -- | cut -d' ' -f1 | tr -s '\n' ' '"); 1032 1032 #else 1033 mr_asprintf( &command, "grep -v nodev /proc/filesystems | tr -s '\t' ' ' | cut -d' ' -f2 | tr -s '\n' ' '");1033 mr_asprintf(command, "grep -v nodev /proc/filesystems | tr -s '\t' ' ' | cut -d' ' -f2 | tr -s '\n' ' '"); 1034 1034 #endif 1035 1035 … … 1094 1094 log_msg(1, "%s needs to have a '/' prefixed - I'll do it", 1095 1095 device_raw); 1096 mr_asprintf( &tmp, "/%s", device_raw);1096 mr_asprintf(tmp, "/%s", device_raw); 1097 1097 } else { 1098 mr_asprintf( &tmp, "%s", device_raw);1098 mr_asprintf(tmp, "%s", device_raw); 1099 1099 } 1100 1100 log_msg(1, "Is %s mounted?", tmp); … … 1105 1105 return(FALSE); 1106 1106 } 1107 mr_asprintf( &device_with_tab, "%s\t", tmp);1108 mr_asprintf( &device_with_space, "%s ", tmp);1107 mr_asprintf(device_with_tab, "%s\t", tmp); 1108 mr_asprintf(device_with_space, "%s ", tmp); 1109 1109 mr_free(tmp); 1110 1110 … … 1126 1126 mr_free(device_with_space); 1127 1127 paranoid_pclose(fin); 1128 mr_asprintf( &tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);1128 mr_asprintf(tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space); 1129 1129 log_msg(4, "tmp (command) = '%s'", tmp); 1130 1130 if (!system(tmp)) { … … 1193 1193 (call_program_and_get_last_line_of_output 1194 1194 ("/sbin/sysctl -n kern.osreldate")) < 500000) { 1195 mr_asprintf( &command, "vnconfig -d %s", dname);1195 mr_asprintf(command, "vnconfig -d %s", dname); 1196 1196 } else { 1197 mr_asprintf( &command, "mdconfig -d -u %s", dname);1197 mr_asprintf(command, "mdconfig -d -u %s", dname); 1198 1198 } 1199 1199 res = system(command); … … 1227 1227 1228 1228 #ifdef __FreeBSD__ 1229 mr_asprintf( &command, "mount_vfat %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);1229 mr_asprintf(command, "mount_vfat %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE); 1230 1230 1231 1231 #else 1232 mr_asprintf( &command, "mount %s -t vfat %s 2>> %s", device, mountpoint, MONDO_LOGFILE);1232 mr_asprintf(command, "mount %s -t vfat %s 2>> %s", device, mountpoint, MONDO_LOGFILE); 1233 1233 #endif 1234 1234 … … 1267 1267 } 1268 1268 #ifndef __FreeBSD__ 1269 mr_asprintf( &options, "ro");1269 mr_asprintf(options, "ro"); 1270 1270 #endif 1271 1271 … … 1273 1273 1274 1274 #ifdef __FreeBSD__ 1275 mr_asprintf( &dev, "%s", make_vn(device));1275 mr_asprintf(dev, "%s", make_vn(device)); 1276 1276 if (!dev) { 1277 mr_asprintf( &command, "Unable to mount ISO (make_vn(%s) failed)", device);1277 mr_asprintf(command, "Unable to mount ISO (make_vn(%s) failed)", device); 1278 1278 fatal_error(command); 1279 1279 } … … 1290 1290 1291 1291 #ifdef __FreeBSD__ 1292 mr_asprintf( &command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);1292 mr_asprintf(command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE); 1293 1293 1294 1294 #else 1295 mr_asprintf( &command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);1295 mr_asprintf(command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE); 1296 1296 paranoid_free(options); 1297 1297 #endif … … 1334 1334 /*@ buffers ********************************************************* */ 1335 1335 char *tmp = NULL; 1336 char *p = NULL; 1336 1337 char *mds = NULL; 1337 1338 char *request = NULL; … … 1347 1348 return; 1348 1349 } 1349 mr_asprintf( &tmp, "mkdir -p " MNT_CDROM);1350 mr_asprintf(tmp, "mkdir -p " MNT_CDROM); 1350 1351 run_program_and_log_output(tmp, 5); 1351 1352 mr_free(tmp); … … 1360 1361 run_program_and_log_output("umount " MNT_CDROM, 5); 1361 1362 } 1362 mr_asprintf( &tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir);1363 mr_asprintf(tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir); 1363 1364 (void)system(tmp); 1364 1365 mr_free(tmp); 1365 1366 1366 mr_asprintf( &tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);1367 mr_asprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want); 1367 1368 if (!does_file_exist(tmp)) { 1368 1369 mr_free(tmp); 1369 mr_asprintf( &tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);1370 mr_asprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want); 1370 1371 if (does_file_exist(tmp)) { 1371 1372 log_msg(1, "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", bkpinfo->isodir, bkpinfo->tmpdir); 1372 sprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir); 1373 mr_free(bkpinfo->isodir); 1374 mr_asprintf(p, "%s/isodir", bkpinfo->tmpdir); 1375 bkpinfo->isodir = p; 1373 1376 } 1374 1377 } … … 1384 1387 cd_number_i_want); 1385 1388 mds = media_descriptor_string(bkpinfo->backup_media_type); 1386 mr_asprintf( &tmp, "Insisting on %s #%d", mds, cd_number_i_want);1387 mr_asprintf( &request, "Please insert %s #%d and press Enter.", mds, cd_number_i_want);1389 mr_asprintf(tmp, "Insisting on %s #%d", mds, cd_number_i_want); 1390 mr_asprintf(request, "Please insert %s #%d and press Enter.", mds, cd_number_i_want); 1388 1391 mr_free(mds); 1389 1392 log_msg(3, tmp); … … 1499 1502 } 1500 1503 mds = media_descriptor_string(bkpinfo->backup_media_type); 1501 mr_asprintf( &comment, "What speed is your %s (re)writer?", mds);1504 mr_asprintf(comment, "What speed is your %s (re)writer?", mds); 1502 1505 if (bkpinfo->backup_media_type == dvd) { 1503 1506 find_dvd_device(bkpinfo->media_device, FALSE); 1504 strcpy(tmp1, "1");1505 mr_asprintf( &sz_size, "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4482 MB1507 mr_asprintf(tmp, "1"); 1508 mr_asprintf(sz_size, "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4482 MB 1506 1509 log_msg(1, "Setting to DVD defaults"); 1507 1510 } else { 1508 1511 strcpy(bkpinfo->media_device, VANILLA_SCSI_CDROM); 1509 strcpy(tmp1, "4");1510 mr_asprintf( &sz_size, "%d", 650);1512 mr_asprintf(tmp, "4"); 1513 mr_asprintf(sz_size, "%d", 650); 1511 1514 log_msg(1, "Setting to CD defaults"); 1512 1515 } … … 1527 1530 bkpinfo->cdrw_speed = atoi(tmp1); // if DVD then this shouldn't ever be used anyway :) 1528 1531 1529 mr_asprintf( &comment, "How much data (in Megabytes) will each %s store?", mds);1532 mr_asprintf(comment, "How much data (in Megabytes) will each %s store?", mds); 1530 1533 mr_free(mds); 1531 1534 p = popup_and_get_string("Size", comment, sz_size); … … 1567 1570 log_msg(1, "bkpinfo->media_device = %s", 1568 1571 bkpinfo->media_device); 1569 mr_asprintf( &comment, "Please specify your %s drive's /dev entry", mds);1572 mr_asprintf(comment, "Please specify your %s drive's /dev entry", mds); 1570 1573 p = popup_and_get_string("Device?", comment, bkpinfo->media_device); 1571 1574 mr_free(comment); … … 1585 1588 if (bkpinfo->media_device[0]) { 1586 1589 if (bkpinfo->backup_media_type == usb) { 1587 mr_asprintf( &tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);1590 mr_asprintf(tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device); 1588 1591 } else { 1589 mr_asprintf( &tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device);1592 mr_asprintf(tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device); 1590 1593 } 1591 1594 if (!ask_me_yes_or_no(tmp)) { … … 1648 1651 } 1649 1652 if (bkpinfo->media_device[0]) { 1650 mr_asprintf( &tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);1653 mr_asprintf(tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device); 1651 1654 if (!ask_me_yes_or_no(tmp)) { 1652 1655 bkpinfo->media_device[0] = '\0'; … … 1663 1666 mr_free(p); 1664 1667 } 1665 mr_asprintf( &tmp, "ls -l %s", bkpinfo->media_device);1668 mr_asprintf(tmp, "ls -l %s", bkpinfo->media_device); 1666 1669 if (run_program_and_log_output(tmp, FALSE)) { 1667 1670 log_to_screen("User has not specified a valid /dev entry"); … … 1726 1729 if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/') 1727 1730 bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0'; 1728 mr_asprintf( &command, "mount | grep \"%s \" | cut -d' ' -f3",1729 bkpinfo->nfs_mount);1730 strcpy(bkpinfo->isodir,1731 call_program_and_get_last_line_of_output(command));1731 mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->nfs_mount); 1732 mr_free(bkpinfo->isodir); 1733 mr_asprintf(p, "%s", call_program_and_get_last_line_of_output(command)); 1734 bkpinfo->isodir = p; 1732 1735 mr_free(command); 1733 1736 1734 1737 if (!bkpinfo->restore_data) { 1735 mr_asprintf( &comment, "How much data (in Megabytes) will each media store?");1738 mr_asprintf(comment, "How much data (in Megabytes) will each media store?"); 1736 1739 // BERLIOS: 4480 shouldn't be hardcoded here 1737 1740 sz_size = popup_and_get_string("Size", comment, "4480"); … … 1742 1745 } 1743 1746 } else { 1744 mr_asprintf( &sz_size, "0");1747 mr_asprintf(sz_size, "0"); 1745 1748 } 1746 1749 for (i = 0; i <= MAX_NOOF_MEDIA; i++) { … … 1754 1757 } 1755 1758 if (bkpinfo->disaster_recovery) { 1756 mr_asprintf( &command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir);1759 mr_asprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir); 1757 1760 (void)system(command); 1758 1761 mr_free(command); … … 1767 1770 } 1768 1771 /* Initiate bkpinfo isodir path from running environment if mount already done */ 1772 mr_free(bkpinfo->isodir); 1769 1773 if (is_this_device_mounted(bkpinfo->nfs_mount)) { 1770 strcpy(bkpinfo->isodir,1771 call_program_and_get_last_line_of_output1772 ("mount | grep \":\" | cut -d' ' -f3 | head -n1")); 1774 mr_asprintf(p, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1")); 1775 bkpinfo->isodir = p; 1776 1773 1777 } else { 1774 sprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir); 1775 mr_asprintf(&command, "mkdir -p %s", bkpinfo->isodir); 1778 mr_asprintf(p, "%s/nfsdir", bkpinfo->tmpdir); 1779 bkpinfo->isodir = p; 1780 mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir); 1776 1781 run_program_and_log_output(command, 5); 1777 1782 mr_free(command); 1778 1783 1779 mr_asprintf( &tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);1784 mr_asprintf(tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir); 1780 1785 run_program_and_log_output(tmp, 3); 1781 1786 mr_free(tmp); … … 1820 1825 finish(1); 1821 1826 } 1822 strcpy(bkpinfo->isodir,p); 1823 mr_free(p); 1827 bkpinfo->isodir = p; 1824 1828 1825 1829 if (archiving_to_media) { … … 1918 1922 bkpinfo->boot_loader = i; 1919 1923 mr_free(bkpinfo->include_paths); 1920 mr_asprintf( &p, "/");1924 mr_asprintf(p, "/"); 1921 1925 bkpinfo->include_paths = p; 1922 1926 … … 1929 1933 bkpinfo->include_paths = p; 1930 1934 1931 mr_asprintf( &tmp, "%s", list_of_NFS_mounts_only());1935 mr_asprintf(tmp, "%s", list_of_NFS_mounts_only()); 1932 1936 if (strlen(tmp) > 2) { 1933 1937 mr_strcat(bkpinfo->exclude_paths, " %s",tmp); … … 1935 1939 mr_free(tmp); 1936 1940 // NTFS 1937 strcpy(tmp1, call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));1938 if (strlen(tmp 1) > 2) {1941 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'")); 1942 if (strlen(tmp) > 2) { 1939 1943 p = popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp); 1940 1944 … … 2008 2012 #else 2009 2013 if (bkpinfo->backup_media_type == nfs) { 2010 log_msg(3, "I think the NFS mount is mounted at %s", 2011 bkpinfo->isodir); 2014 log_msg(3, "I think the NFS mount is mounted at %s", bkpinfo->isodir); 2012 2015 } 2013 2016 log_it("isodir = %s", bkpinfo->isodir); … … 2061 2064 static char result_sz[1024]; 2062 2065 2063 mr_asprintf( &exclude_these_directories,"%s",list_of_NFS_mounts_only());2064 mr_asprintf( &exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));2066 mr_asprintf(exclude_these_directories,"%s",list_of_NFS_mounts_only()); 2067 mr_asprintf(exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'")); 2065 2068 snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices); 2066 2069 mr_free(exclude_these_devices); … … 2083 2086 static char result_sz[512]; 2084 2087 2085 mr_asprintf( &exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));2088 mr_asprintf(exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'")); 2086 2089 snprintf(result_sz, 511, "%s", exclude_these_directories); 2087 2090 mr_free(exclude_these_directories); … … 2112 2115 make_hole_for_file(store_name_here); 2113 2116 mkfifo(store_name_here, S_IRWXU | S_IRWXG); 2114 mr_asprintf( &tmp, "chmod 770 %s", store_name_here);2117 mr_asprintf(tmp, "chmod 770 %s", store_name_here); 2115 2118 paranoid_system(tmp); 2116 2119 mr_free(tmp); … … 2135 2138 2136 2139 #ifdef __FreeBSD__ 2137 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));2140 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2138 2141 #else 2139 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));2142 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/ /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'")); 2140 2143 #endif 2141 2144 2142 2145 if (tmp[0] != '/') { 2143 mr_asprintf( &sz, "%s", tmp);2146 mr_asprintf(sz, "%s", tmp); 2144 2147 mr_free(tmp); 2145 mr_asprintf( &tmp, "/%s", sz);2148 mr_asprintf(tmp, "/%s", sz); 2146 2149 mr_free(sz); 2147 2150 } … … 2149 2152 fatal_error("I couldn't figure out the scratchdir!"); 2150 2153 } 2151 mr_asprintf( &sz, "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));2154 mr_asprintf(sz, "%s/mondo.scratch.%d", tmp, (int) (random() % 32768)); 2152 2155 mr_free(bkpinfo->scratchdir); 2153 2156 bkpinfo->scratchdir = sz; 2154 2157 log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir); 2155 2158 2156 mr_asprintf( &command, "rm -Rf %s/mondo.scratch.*", tmp);2159 mr_asprintf(command, "rm -Rf %s/mondo.scratch.*", tmp); 2157 2160 mr_free(tmp); 2158 2161 … … 2192 2195 return (FALSE); 2193 2196 } 2194 mr_asprintf( &command, "dd bs=%ld count=1 if=%s of=/dev/null &> /dev/null", 512L, dev);2197 mr_asprintf(command, "dd bs=%ld count=1 if=%s of=/dev/null &> /dev/null", 512L, dev); 2195 2198 if (!run_program_and_log_output(command, FALSE) 2196 2199 && !run_program_and_log_output(command, FALSE)) { … … 2227 2230 // log_it("Asking what_number_cd_is_this"); 2228 2231 if (g_ISO_restore_mode) { 2229 mr_asprintf( &tmp, "mount | grep iso9660 | awk '{print $3;}'");2230 2231 mr_asprintf( &mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");2232 mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'"); 2233 2234 mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER"); 2232 2235 cd_number = atoi(last_line_of_file(mountdev)); 2233 2236 paranoid_free(mountdev); … … 2237 2240 } 2238 2241 2239 mr_asprintf( &mountdev, "%s", bkpinfo->media_device);2242 mr_asprintf(mountdev, "%s", bkpinfo->media_device); 2240 2243 if (!mountdev[0]) { 2241 2244 log_it … … 2370 2373 assert(which_device != NULL); 2371 2374 2372 mr_asprintf( &list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());2375 mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted()); 2373 2376 log_it("list_drives_cmd = %s", list_drives_cmd); 2374 2377 … … 2412 2415 } else { 2413 2416 // We need to look on each partition then 2414 mr_asprintf( &list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");2417 mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 2415 2418 log_it("list_drives_cmd = %s", list_drives_cmd); 2416 2419 … … 2513 2516 while (S_ISLNK(statbuf.st_mode)) { 2514 2517 log_msg(1, "curr_fname = %s", curr_fname); 2515 mr_asprintf( &command, "file %s", curr_fname);2516 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));2518 mr_asprintf(command, "file %s", curr_fname); 2519 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 2517 2520 mr_free(command); 2518 2521 for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' '; 2519 2522 p--); 2520 2523 p++; 2521 mr_asprintf( &scratch, "%s", p);2524 mr_asprintf(scratch, "%s", p); 2522 2525 for (p = scratch; *p != '\0' && *p != '\''; p++); 2523 2526 *p = '\0'; … … 2563 2566 #endif 2564 2567 log_msg(0, "Looking for partition table format type"); 2565 mr_asprintf( &fdisk, "/sbin/parted2fdisk");2568 mr_asprintf(fdisk, "/sbin/parted2fdisk"); 2566 2569 log_msg(1, "Using %s", fdisk); 2567 mr_asprintf( &command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);2570 mr_asprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive); 2568 2571 mr_free(fdisk); 2569 2572 2570 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));2573 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 2571 2574 mr_free(command); 2572 2575 -
branches/2.2.10/mondo/src/common/libmondo-fifo.c
r2296 r2323 88 88 for (bufsize = wise_upper_limit, res = -1; 89 89 res != 0 && bufsize >= wise_lower_limit; bufsize--) { 90 mr_asprintf( &tmp, "dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c", internal_tape_block_size, bufsize, 'm');90 mr_asprintf(tmp, "dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c", internal_tape_block_size, bufsize, 'm'); 91 91 res = run_program_and_log_output(tmp, 2); 92 92 mr_free(tmp); … … 94 94 if (!res) { 95 95 bufsize++; 96 mr_asprintf( &tmp, "Negotiated max buffer of %d MB ", bufsize);96 mr_asprintf(tmp, "Negotiated max buffer of %d MB ", bufsize); 97 97 log_to_screen(tmp); 98 98 mr_free(tmp); … … 118 118 } 119 119 log_msg(2, "Calling buffer --- command = '%s'", g_sz_call_to_buffer); 120 mr_asprintf( &sz_dir, "%c", direction);120 mr_asprintf(sz_dir, "%c", direction); 121 121 fres = popen(g_sz_call_to_buffer, sz_dir); 122 122 mr_free(sz_dir); … … 130 130 } 131 131 sleep(2); 132 mr_asprintf( &tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);132 mr_asprintf(tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer); 133 133 if (run_program_and_log_output(tmp, 2)) { 134 134 log_msg(2, "Warning - I think I failed to open tape, actually."); … … 136 136 mr_free(tmp); 137 137 g_tape_buffer_size_MB = bufsize; 138 mr_asprintf( &command, "ps %s | grep buffer | grep -v grep", ps_options);138 mr_asprintf(command, "ps %s | grep buffer | grep -v grep", ps_options); 139 139 if (run_program_and_log_output(command, 1)) { 140 140 fres = NULL; … … 165 165 } 166 166 paranoid_system("sync"); 167 mr_asprintf( &command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer);167 mr_asprintf(command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer); 168 168 log_msg(2, "kill_buffer() --- command = %s", command); 169 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));169 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 170 170 mr_free(command); 171 171 172 mr_asprintf( &command, "kill %s", tmp);172 mr_asprintf(command, "kill %s", tmp); 173 173 log_msg(2, "kill_buffer() --- command = %s", command); 174 174 if (strlen(tmp) > 0) { -
branches/2.2.10/mondo/src/common/libmondo-filelist.c
r2321 r2323 97 97 log_to_screen("Dividing filelist into sets. Please wait."); 98 98 i = 0; 99 mr_asprintf( &filelist, "%s/archives/filelist.full", bkpinfo->scratchdir);99 mr_asprintf(filelist, "%s/archives/filelist.full", bkpinfo->scratchdir); 100 100 if (!does_file_exist(filelist)) { 101 101 log_it("filelist %s not found", filelist); … … 108 108 estimate_noof_media_required(noof_sets); // for cosmetic purposes 109 109 110 mr_asprintf( &tempfile, "%s/biggielist.txt", bkpinfo->tmpdir);110 mr_asprintf(tempfile, "%s/biggielist.txt", bkpinfo->tmpdir); 111 111 if (!(fout = fopen(tempfile, "a"))) { 112 112 log_OS_error("Cannot append to biggielist"); … … 158 158 } // no sense in trying to sort an empty file 159 159 160 mr_asprintf( &tmp_fname, "%s/sortfile", bkpinfo->tmpdir);161 162 mr_asprintf( &command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE);160 mr_asprintf(tmp_fname, "%s/sortfile", bkpinfo->tmpdir); 161 162 mr_asprintf(command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE); 163 163 retval = system(command); 164 164 mr_free(command); … … 168 168 } else { 169 169 log_msg(5, "Sorted %s --> %s OK. Copying it back to %s now", orig_fname, tmp_fname, orig_fname); 170 mr_asprintf( &command, "mv -f %s %s", tmp_fname, orig_fname);170 mr_asprintf(command, "mv -f %s %s", tmp_fname, orig_fname); 171 171 retval += run_program_and_log_output(command, 5); 172 172 mr_free(command); … … 240 240 curr_set_no = 0; 241 241 curr_set_size = 0; 242 mr_asprintf( &outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no);243 mr_asprintf( &biggie_fname, "%s/biggielist.txt", bkpinfo->tmpdir);242 mr_asprintf(outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no); 243 mr_asprintf(biggie_fname, "%s/biggielist.txt", bkpinfo->tmpdir); 244 244 log_it("outfname=%s; biggie_fname=%s", outfname, biggie_fname); 245 245 if (!(fbig = fopen(biggie_fname, "w"))) { … … 293 293 curr_set_size = 0; 294 294 295 mr_asprintf( &outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no);295 mr_asprintf(outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no); 296 296 if (!(fout = fopen(outfname, "w"))) { 297 297 log_OS_error("Unable to openout outfname"); … … 323 323 mr_free(biggie_fname); 324 324 325 mr_asprintf( &outfname, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);326 mr_asprintf( &tmp, "%ld", curr_set_no);325 mr_asprintf(outfname, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir); 326 mr_asprintf(tmp, "%ld", curr_set_no); 327 327 if (write_one_liner_data_file(outfname, tmp)) { 328 328 log_OS_error … … 334 334 335 335 if (curr_set_no == 0) { 336 mr_asprintf( &tmp, "Only one fileset. Fine.");336 mr_asprintf(tmp, "Only one fileset. Fine."); 337 337 } else { 338 mr_asprintf( &tmp, "Filelist divided into %ld sets", curr_set_no + 1);338 mr_asprintf(tmp, "Filelist divided into %ld sets", curr_set_no + 1); 339 339 } 340 340 log_msg(1, tmp); … … 453 453 return (1); 454 454 } 455 mr_asprintf( &pout_command, "gzip -c1 > %s", auxlist_fname);455 mr_asprintf(pout_command, "gzip -c1 > %s", auxlist_fname); 456 456 if (!(pout = popen(pout_command, "w"))) { 457 457 log_msg(1, "Cannot openout auxlist_fname %s", auxlist_fname); … … 471 471 log_msg(8, "Analyzing %s", file_to_analyze); 472 472 tmp = mr_stresc(file_to_analyze, "`$\\\"(){}[]'*?&|!#~", '\\'); 473 mr_asprintf( &strtmp, syscall_sprintf, tmp);473 mr_asprintf(strtmp, syscall_sprintf, tmp); 474 474 paranoid_free(tmp); 475 mr_asprintf( &syscall, "%s 2>> /dev/null", strtmp); // " MONDO_LOGFILE);475 mr_asprintf(syscall, "%s 2>> /dev/null", strtmp); // " MONDO_LOGFILE); 476 476 paranoid_free(strtmp); 477 477 call_exe_and_pipe_output_to_fd(syscall, pout); … … 491 491 492 492 if (g_getfacl != NULL) { 493 mr_asprintf( &command, "touch %s", facl_fname);493 mr_asprintf(command, "touch %s", facl_fname); 494 494 run_program_and_log_output(command, 8); 495 495 mr_free(command); 496 496 497 mr_asprintf( &command, "getfacl --all-effective -P %s 2>> %s | gzip -c1 > %s 2>> %s", filelist, MONDO_LOGFILE, facl_fname, MONDO_LOGFILE);497 mr_asprintf(command, "getfacl --all-effective -P %s 2>> %s | gzip -c1 > %s 2>> %s", filelist, MONDO_LOGFILE, facl_fname, MONDO_LOGFILE); 498 498 log_it("%s",command); 499 499 retval = system(command); … … 510 510 511 511 if (g_getfattr != NULL) { 512 mr_asprintf( &command, "touch %s", fattr_fname);512 mr_asprintf(command, "touch %s", fattr_fname); 513 513 run_program_and_log_output(command, 8); 514 514 mr_free(command); … … 540 540 || !does_file_exist(orig_msklist)) { 541 541 log_msg(1, "No masklist provided. I shall therefore set ALL attributes."); 542 mr_asprintf( &command, "gzip -dc %s | %s --restore - 2>> %s", original_exat_fname, executable, MONDO_LOGFILE);542 mr_asprintf(command, "gzip -dc %s | %s --restore - 2>> %s", original_exat_fname, executable, MONDO_LOGFILE); 543 543 log_msg(1, "command = %s", command); 544 544 retval = system(command); … … 554 554 malloc_string(current_subset_file); 555 555 malloc_string(current_master_file); 556 mr_asprintf( &masklist, "%s/masklist", bkpinfo->tmpdir);557 mr_asprintf( &command, "cp -f %s %s", orig_msklist, masklist);556 mr_asprintf(masklist, "%s/masklist", bkpinfo->tmpdir); 557 mr_asprintf(command, "cp -f %s %s", orig_msklist, masklist); 558 558 run_program_and_log_output(command, 1); 559 559 mr_free(command); … … 562 562 current_subset_file[0] = current_master_file[0] = '\0'; 563 563 564 mr_asprintf( &syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE);564 mr_asprintf(syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE); 565 565 log_msg(1, "syscall_pout = %s", syscall_pout); 566 566 pout = popen(syscall_pout, "w"); … … 573 573 } 574 574 575 mr_asprintf( &syscall_pin, "gzip -dc %s", original_exat_fname);575 mr_asprintf(syscall_pin, "gzip -dc %s", original_exat_fname); 576 576 log_msg(1, "syscall_pin = %s", syscall_pin); 577 577 pin = popen(syscall_pin, "r"); … … 714 714 715 715 strcpy(val_sz,""); 716 mr_asprintf( &cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir);716 mr_asprintf(cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir); 717 717 read_cfg_var(cfg_fname, "last-filelist-number", val_sz); 718 718 mr_free(cfg_fname); … … 876 876 } 877 877 log_to_screen("Loading filelist"); 878 mr_asprintf( &tmp1, "zcat %s | wc -l", filelist_fname);878 mr_asprintf(tmp1, "zcat %s | wc -l", filelist_fname); 879 879 log_msg(6, "tmp1 = %s", tmp1); 880 880 lines_in_filelist = atol(call_program_and_get_last_line_of_output(tmp1)); … … 896 896 (filelist->down)->expanded = (filelist->down)->selected = FALSE; 897 897 898 mr_asprintf( &command_to_open_fname, "gzip -dc %s", filelist_fname);898 mr_asprintf(command_to_open_fname, "gzip -dc %s", filelist_fname); 899 899 if (!(pin = popen(command_to_open_fname, "r"))) { 900 900 log_OS_error("Unable to openin filelist_fname"); … … 1368 1368 malloc_string(name_of_evalcall_form); 1369 1369 malloc_string(find_skeleton_marker); 1370 mr_asprintf( &find_excludes, " ");1370 mr_asprintf(find_excludes, " "); 1371 1371 if (sth != NULL) { 1372 1372 while((token = mr_strtok(sth, delims, &lastpos))) { … … 1377 1377 #if linux 1378 1378 // 2.6 has /sys as a proc-type thing -- must be excluded 1379 mr_asprintf( &strtmp, "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist);1379 mr_asprintf(strtmp, "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist); 1380 1380 #else 1381 1381 // On BSD, for example, /sys is the kernel sources -- don't exclude 1382 mr_asprintf( &strtmp, "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist);1382 mr_asprintf(strtmp, "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist); 1383 1383 #endif 1384 1384 mr_free(find_excludes); … … 1388 1388 mr_free(strtmp); 1389 1389 1390 mr_asprintf( &tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);1390 mr_asprintf(tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist); 1391 1391 g_skeleton_entries = 1 + atol(call_program_and_get_last_line_of_output(tmp)); 1392 1392 mr_free(tmp); … … 1414 1414 #ifndef _XWIN 1415 1415 if (!g_text_mode) { 1416 mr_asprintf( &tmp, "Reading %-68s", dir);1416 mr_asprintf(tmp, "Reading %-68s", dir); 1417 1417 newtDrawRootText(0, g_noof_rows - 3, tmp); 1418 1418 paranoid_free(tmp); … … 1428 1428 // log_msg(0, "Cataloguing %s", dir); 1429 1429 if (sth[0] == ' ') { 1430 mr_asprintf( &skip_these, "%s", sth);1430 mr_asprintf(skip_these, "%s", sth); 1431 1431 } else { 1432 mr_asprintf( &skip_these, " %s ", sth);1433 } 1434 mr_asprintf( &new_with_spaces, " %s ", dir);1432 mr_asprintf(skip_these, " %s ", sth); 1433 } 1434 mr_asprintf(new_with_spaces, " %s ", dir); 1435 1435 if ((dip = opendir(dir)) == NULL) { 1436 mr_asprintf( &tmp,"opendir %s", dir);1436 mr_asprintf(tmp,"opendir %s", dir); 1437 1437 log_OS_error(tmp); 1438 1438 paranoid_free(tmp); … … 1444 1444 i++; 1445 1445 if (strcmp(dir, "/")) { 1446 mr_asprintf( &new,"%s/%s",dir,dit->d_name);1446 mr_asprintf(new,"%s/%s",dir,dit->d_name); 1447 1447 } else { 1448 mr_asprintf( &new,"%s%s",dir,dit->d_name);1448 mr_asprintf(new,"%s%s",dir,dit->d_name); 1449 1449 } 1450 1450 paranoid_free(new_with_spaces); 1451 mr_asprintf( &new_with_spaces, " %s ", new);1451 mr_asprintf(new_with_spaces, " %s ", new); 1452 1452 if (strstr(skip_these, new_with_spaces)) { 1453 1453 fprintf(fout, "%s\n", new); … … 1468 1468 counter = 0; 1469 1469 uberctr++; 1470 mr_asprintf( &tmp, " %c ", special_dot_char(uberctr));1470 mr_asprintf(tmp, " %c ", special_dot_char(uberctr)); 1471 1471 #ifndef _XWIN 1472 1472 if (!g_text_mode) { … … 1521 1521 bool in_quotes = FALSE; 1522 1522 1523 mr_asprintf( &sz_res, "%s", incoming);1523 mr_asprintf(sz_res, "%s", incoming); 1524 1524 p = sz_res; 1525 1525 while ((*p != ' ' || in_quotes) && *p != '\0') { … … 1563 1563 malloc_string(tmp); 1564 1564 malloc_string(g_skeleton_filelist); 1565 mr_asprintf( &sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);1565 mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0); 1566 1566 if (!include_paths && !userdef_filelist) { 1567 1567 fatal_error … … 1569 1569 } 1570 1570 // make hole for filelist 1571 mr_asprintf( &command, "mkdir -p %s/archives", bkpinfo->scratchdir);1571 mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir); 1572 1572 paranoid_system(command); 1573 1573 mr_free(command); 1574 1574 1575 mr_asprintf( &sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);1575 mr_asprintf(sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir); 1576 1576 make_hole_for_file(sz_filelist); 1577 1577 1578 1578 if (differential == 0) { 1579 1579 // restore last good datefile if it exists 1580 mr_asprintf( &command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);1580 mr_asprintf(command, "cp -f %s.aborted %s", sz_datefile, sz_datefile); 1581 1581 run_program_and_log_output(command, 3); 1582 1582 mr_free(command); … … 1584 1584 // backup last known good datefile just in case :) 1585 1585 if (does_file_exist(sz_datefile)) { 1586 mr_asprintf( &command, "mv -f %s %s.aborted", sz_datefile,1586 mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile, 1587 1587 sz_datefile); 1588 1588 paranoid_system(command); … … 1609 1609 "Using the user-specified filelist - %s - instead of calculating one", 1610 1610 userdef_filelist); 1611 mr_asprintf( &command, "cp -f %s %s", userdef_filelist, sz_filelist);1611 mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist); 1612 1612 if (run_program_and_log_output(command, 3)) { 1613 1613 mr_free(command); … … 1620 1620 } 1621 1621 log_msg(1, "Calculating filelist"); 1622 mr_asprintf( &tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));1622 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'")); 1623 1623 if (strlen(tmp2) < 1) { 1624 mr_asprintf( &tmp1," ");1624 mr_asprintf(tmp1," "); 1625 1625 } else { 1626 1626 log_msg(2, "Found windows FS: %s",tmp2); 1627 mr_asprintf( &tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);1627 mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2); 1628 1628 paranoid_free(tmp2); 1629 mr_asprintf( &tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));1629 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1)); 1630 1630 log_msg(2, "Found windows files: %s",tmp2); 1631 1631 } 1632 1632 mr_free(tmp1); 1633 1633 1634 mr_asprintf( &exclude_paths, " %s %s %s %s %s . .. " MNT_CDROM " " MNT_FLOPPY " /media /tmp /proc /sys " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir);1634 mr_asprintf(exclude_paths, " %s %s %s %s %s . .. " MNT_CDROM " " MNT_FLOPPY " /media /tmp /proc /sys " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir); 1635 1635 mr_free(tmp2); 1636 1636 … … 1667 1667 } 1668 1668 log_msg(2, "Copying new filelist to scratchdir"); 1669 mr_asprintf( &command, "mkdir -p %s/archives", bkpinfo->scratchdir);1669 mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir); 1670 1670 paranoid_system(command); 1671 1671 mr_free(command); 1672 1672 1673 mr_asprintf( &command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir);1673 mr_asprintf(command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir); 1674 1674 paranoid_system(command); 1675 1675 mr_free(command); 1676 1676 1677 mr_asprintf( &command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir);1677 mr_asprintf(command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir); 1678 1678 paranoid_system(command); 1679 1679 mr_free(command); -
branches/2.2.10/mondo/src/common/libmondo-files.c
r2321 r2323 62 62 assert_string_is_neither_NULL_nor_zerolength(filename); 63 63 if (does_file_exist(filename)) { 64 mr_asprintf( &command, "md5sum \"%s\"", filename);64 mr_asprintf(command, "md5sum \"%s\"", filename); 65 65 fin = popen(command, "r"); 66 66 if (fin) { … … 71 71 mr_free(command); 72 72 } else { 73 mr_asprintf( &tmp, "File '%s' not found; cannot calc checksum", filename);73 mr_asprintf(tmp, "File '%s' not found; cannot calc checksum", filename); 74 74 log_it(tmp); 75 75 mr_free(tmp); … … 142 142 assert_string_is_neither_NULL_nor_zerolength(filename); 143 143 if (!does_file_exist(filename)) { 144 mr_asprintf( &tmp, "%s does not exist, so I cannot found the number of lines in it", filename);144 mr_asprintf(tmp, "%s does not exist, so I cannot found the number of lines in it", filename); 145 145 log_it(tmp); 146 146 mr_free(tmp); 147 147 return (0); 148 148 } 149 mr_asprintf( &command, "cat %s | wc -l", filename);149 mr_asprintf(command, "cat %s | wc -l", filename); 150 150 if (!does_file_exist(filename)) { 151 151 mr_free(command); … … 224 224 225 225 assert_string_is_neither_NULL_nor_zerolength(inout); 226 mr_asprintf( &infname, "%s.in", inout);227 mr_asprintf( &outfname, "%s", inout);228 mr_asprintf( &tmp, "cp -f %s %s", inout, infname);226 mr_asprintf(infname, "%s.in", inout); 227 mr_asprintf(outfname, "%s", inout); 228 mr_asprintf(tmp, "cp -f %s %s", inout, infname); 229 229 run_program_and_log_output(tmp, FALSE); 230 230 mr_free(tmp); … … 251 251 fprintf(fout, "%s\n", incoming); 252 252 } else { 253 mr_asprintf( &tmp, "Excluding '%s'-nonexistent\n", incoming);253 mr_asprintf(tmp, "Excluding '%s'-nonexistent\n", incoming); 254 254 log_it(tmp); 255 255 mr_free(tmp); … … 289 289 // If we didn't get anything back, check whether mindi raised a fatal error 290 290 if (!kernel[0]) { 291 mr_asprintf( &command, "%s", "grep 'Fatal error' /var/log/mindi.log");292 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));291 mr_asprintf(command, "%s", "grep 'Fatal error' /var/log/mindi.log"); 292 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 293 293 if (strlen(tmp) > 1) { 294 294 popup_and_OK(tmp); … … 344 344 345 345 assert_string_is_neither_NULL_nor_zerolength(fname); 346 mr_asprintf( &command, "which %s 2> /dev/null", fname);346 mr_asprintf(command, "which %s 2> /dev/null", fname); 347 347 strcpy(incoming, call_program_and_get_last_line_of_output(command)); 348 348 mr_free(command); … … 353 353 return (NULL); // forget it :) 354 354 } 355 mr_asprintf( &command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming);355 mr_asprintf(command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming); 356 356 strcpy(incoming, 357 357 call_program_and_get_last_line_of_output(command)); … … 360 360 if (incoming[0] == '\0') // yes, it is == '\0' twice, not once :) 361 361 { 362 mr_asprintf( &command, "dirname %s 2> /dev/null", incoming);362 mr_asprintf(command, "dirname %s 2> /dev/null", incoming); 363 363 strcpy(incoming, 364 364 call_program_and_get_last_line_of_output(command)); … … 452 452 && !strstr(err_log_lines[i], "% done"); i--); 453 453 if (i < 0) { 454 mr_asprintf( &command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%');454 mr_asprintf(command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%'); 455 455 strcpy(lastline, 456 456 call_program_and_get_last_line_of_output(command)); … … 503 503 504 504 if (!does_file_exist(filename)) { 505 mr_asprintf( &tmp, "Tring to get last line of nonexistent file (%s)", filename);505 mr_asprintf(tmp, "Tring to get last line of nonexistent file (%s)", filename); 506 506 log_it(tmp); 507 507 mr_free(tmp); … … 509 509 return (output); 510 510 } 511 mr_asprintf( &command, "tail -n1 %s", filename);511 mr_asprintf(command, "tail -n1 %s", filename); 512 512 fin = popen(command, "r"); 513 513 mr_free(command); … … 602 602 stub_fname[i] = '\0'; 603 603 } 604 mr_asprintf( &tmp, "%s%s", comppath, stub_fname);604 mr_asprintf(tmp, "%s%s", comppath, stub_fname); 605 605 strcpy(curr_fname, tmp + 1); 606 606 mr_free(tmp); … … 620 620 time_remaining = 621 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);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 623 log_to_screen(tmp); 624 624 mr_free(tmp); … … 645 645 646 646 assert_string_is_neither_NULL_nor_zerolength(outdir_fname); 647 mr_asprintf( &tmp, "mkdir -p %s", outdir_fname);647 mr_asprintf(tmp, "mkdir -p %s", outdir_fname); 648 648 res = system(tmp); 649 649 mr_free(tmp); … … 671 671 assert(!strstr(outfile_fname, MNT_CDROM)); 672 672 assert(!strstr(outfile_fname, "/dev/cdrom")); 673 mr_asprintf( &command, "mkdir -p \"%s\" 2> /dev/null", outfile_fname);673 mr_asprintf(command, "mkdir -p \"%s\" 2> /dev/null", outfile_fname); 674 674 res += system(command); 675 675 mr_free(command); 676 676 677 mr_asprintf( &command, "rmdir \"%s\" 2> /dev/null", outfile_fname);677 mr_asprintf(command, "rmdir \"%s\" 2> /dev/null", outfile_fname); 678 678 res += system(command); 679 679 mr_free(command); 680 680 681 mr_asprintf( &command, "rm -f \"%s\" 2> /dev/null", outfile_fname);681 mr_asprintf(command, "rm -f \"%s\" 2> /dev/null", outfile_fname); 682 682 res += system(command); 683 683 mr_free(command); … … 742 742 long file_len_K; 743 743 744 mr_asprintf( &mountlist, "%s/mountlist.txt", tmpdir);745 mr_asprintf( &command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, tmpdir);744 mr_asprintf(mountlist, "%s/mountlist.txt", tmpdir); 745 mr_asprintf(command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, tmpdir); 746 746 mr_free(mountlist); 747 747 … … 782 782 malloc_string(fname); 783 783 log_it("Calculating size of all biggiefiles (in total)"); 784 mr_asprintf( &biggielist, "%s/biggielist.txt", bkpinfo->tmpdir);784 mr_asprintf(biggielist, "%s/biggielist.txt", bkpinfo->tmpdir); 785 785 log_it("biggielist = %s", biggielist); 786 786 fin = fopen(biggielist, "r"); … … 801 801 fatal_error("ntfsresize not found"); 802 802 } 803 mr_asprintf( &command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", fname);803 mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", fname); 804 804 log_it("command = %s", command); 805 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));805 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 806 806 mr_free(command); 807 807 … … 820 820 log_msg(4, "%s --> %ld K", fname, file_len_K); 821 821 } 822 mr_asprintf( &comment, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL);822 mr_asprintf(comment, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL); 823 823 log_msg(4, comment); 824 824 mr_free(comment); … … 853 853 /*@ end vars *************************************************** */ 854 854 855 mr_asprintf( &command, "du -sk %s", mountpt);855 mr_asprintf(command, "du -sk %s", mountpt); 856 856 errno = 0; 857 857 fin = popen(command, "r"); … … 923 923 int res = 0; 924 924 925 mr_asprintf( &command, "which %s > /dev/null 2> /dev/null", fname);925 mr_asprintf(command, "which %s > /dev/null 2> /dev/null", fname); 926 926 res = system(command); 927 927 mr_free(command); 928 928 929 929 if (res) { 930 mr_asprintf( &errorstr, "Please install '%s'. I cannot find it on your system.", fname);930 mr_asprintf(errorstr, "Please install '%s'. I cannot find it on your system.", fname); 931 931 log_to_screen(errorstr); 932 932 mr_free(errorstr); … … 1041 1041 find_and_store_mondoarchives_home(g_mondo_home); 1042 1042 } 1043 mr_asprintf( &command, CP_BIN " --parents -pRdf %s %s", g_mondo_home, bkpinfo->scratchdir);1043 mr_asprintf(command, CP_BIN " --parents -pRdf %s %s", g_mondo_home, bkpinfo->scratchdir); 1044 1044 1045 1045 log_msg(4, "command = %s", command); … … 1051 1051 } 1052 1052 1053 mr_asprintf( &command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, bkpinfo->scratchdir);1053 mr_asprintf(command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, bkpinfo->scratchdir); 1054 1054 res = run_program_and_log_output(command, FALSE); 1055 1055 mr_free(command); … … 1065 1065 ("'which mondorestore' returned null. Where's your mondorestore? `which` can't find it. That's odd. Did you install mondorestore?"); 1066 1066 } 1067 mr_asprintf( &command, "cp -f %s %s", tmp, bkpinfo->tmpdir);1067 mr_asprintf(command, "cp -f %s %s", tmp, bkpinfo->tmpdir); 1068 1068 res = run_program_and_log_output(command, FALSE); 1069 1069 mr_free(command); … … 1073 1073 } 1074 1074 1075 mr_asprintf( &command, "hostname > %s/HOSTNAME", bkpinfo->scratchdir);1075 mr_asprintf(command, "hostname > %s/HOSTNAME", bkpinfo->scratchdir); 1076 1076 paranoid_system(command); 1077 1077 mr_free(command); 1078 1078 1079 1079 if (bkpinfo->postnuke_tarball[0]) { 1080 mr_asprintf( &command, "cp -f %s %s/post-nuke.tgz", bkpinfo->postnuke_tarball, bkpinfo->tmpdir);1080 mr_asprintf(command, "cp -f %s %s/post-nuke.tgz", bkpinfo->postnuke_tarball, bkpinfo->tmpdir); 1081 1081 res = run_program_and_log_output(command, FALSE); 1082 1082 mr_free(command); … … 1121 1121 1122 1122 log_it("Storing NFS configuration"); 1123 mr_asprintf( &tmp, "%s", bkpinfo->nfs_mount);1123 mr_asprintf(tmp, "%s", bkpinfo->nfs_mount); 1124 1124 p = strchr(tmp, ':'); 1125 1125 if (!p) { … … 1128 1128 } 1129 1129 *(p++) = '\0'; 1130 mr_asprintf( &nfs_server_ipaddr, "%s", tmp);1131 mr_asprintf( &nfs_mount, "%s", p);1130 mr_asprintf(nfs_server_ipaddr, "%s", tmp); 1131 mr_asprintf(nfs_mount, "%s", p); 1132 1132 mr_free(tmp); 1133 1133 1134 1134 /* BERLIOS : there is a bug #67 here as it only considers the first NIC */ 1135 mr_asprintf( &command, "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1");1136 mr_asprintf( &nfs_dev, "%s", call_program_and_get_last_line_of_output(command));1137 mr_free(command); 1138 1139 mr_asprintf( &command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2");1140 mr_asprintf( &nfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command));1141 mr_free(command); 1142 1143 mr_asprintf( &command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2");1144 mr_asprintf( &nfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command));1145 mr_free(command); 1146 1147 mr_asprintf( &command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2");1148 mr_asprintf( &nfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command));1149 mr_free(command); 1150 1151 mr_asprintf( &command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'");1152 mr_asprintf( &nfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command));1135 mr_asprintf(command, "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1"); 1136 mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command)); 1137 mr_free(command); 1138 1139 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2"); 1140 mr_asprintf(nfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command)); 1141 mr_free(command); 1142 1143 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2"); 1144 mr_asprintf(nfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command)); 1145 mr_free(command); 1146 1147 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2"); 1148 mr_asprintf(nfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command)); 1149 mr_free(command); 1150 1151 mr_asprintf(command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'"); 1152 mr_asprintf(nfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command)); 1153 1153 mr_free(command); 1154 1154 … … 1168 1168 if (!strncmp(nfs_dev, "bond", 4) || !strncmp(nfs_dev, "alb", 3) || !strncmp(nfs_dev, "aft", 3)) { 1169 1169 log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", nfs_dev); 1170 mr_asprintf( &command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", nfs_dev);1171 mr_asprintf( &mac_addr, "%s", call_program_and_get_last_line_of_output(command));1170 mr_asprintf(command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", nfs_dev); 1171 mr_asprintf(mac_addr, "%s", call_program_and_get_last_line_of_output(command)); 1172 1172 mr_free(command); 1173 1173 1174 mr_asprintf( &command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,nfs_dev);1174 mr_asprintf(command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,nfs_dev); 1175 1175 mr_free(mac_addr); 1176 1176 mr_free(nfs_dev); 1177 1177 1178 mr_asprintf( &nfs_dev, "%s", call_program_and_get_last_line_of_output(command));1178 mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command)); 1179 1179 mr_free(command); 1180 1180 … … 1182 1182 } 1183 1183 1184 mr_asprintf( &tmp, "%s/NFS-DEV", bkpinfo->tmpdir);1184 mr_asprintf(tmp, "%s/NFS-DEV", bkpinfo->tmpdir); 1185 1185 write_one_liner_data_file(tmp, nfs_dev); 1186 1186 mr_free(nfs_dev); 1187 1187 mr_free(tmp); 1188 1188 1189 mr_asprintf( &tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir);1189 mr_asprintf(tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir); 1190 1190 write_one_liner_data_file(tmp, nfs_client_ipaddr); 1191 1191 mr_free(nfs_client_ipaddr); 1192 1192 mr_free(tmp); 1193 1193 1194 mr_asprintf( &tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir);1194 mr_asprintf(tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir); 1195 1195 write_one_liner_data_file(tmp, nfs_client_netmask); 1196 1196 mr_free(nfs_client_netmask); 1197 1197 mr_free(tmp); 1198 1198 1199 mr_asprintf( &tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir);1199 mr_asprintf(tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir); 1200 1200 write_one_liner_data_file(tmp, nfs_client_broadcast); 1201 1201 mr_free(nfs_client_broadcast); 1202 1202 mr_free(tmp); 1203 1203 1204 mr_asprintf( &tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir);1204 mr_asprintf(tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir); 1205 1205 write_one_liner_data_file(tmp, nfs_client_defgw); 1206 1206 mr_free(nfs_client_defgw); 1207 1207 mr_free(tmp); 1208 1208 1209 mr_asprintf( &tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir);1209 mr_asprintf(tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir); 1210 1210 write_one_liner_data_file(tmp, nfs_server_ipaddr); 1211 1211 mr_free(tmp); 1212 1212 mr_free(nfs_server_ipaddr); 1213 1213 1214 mr_asprintf( &tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir);1214 mr_asprintf(tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir); 1215 1215 write_one_liner_data_file(tmp, bkpinfo->nfs_mount); 1216 1216 mr_free(tmp); 1217 1217 mr_free(nfs_mount); 1218 1218 1219 mr_asprintf( &tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir);1219 mr_asprintf(tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir); 1220 1220 write_one_liner_data_file(tmp, bkpinfo->nfs_remote_dir); 1221 1221 mr_free(tmp); 1222 1222 1223 mr_asprintf( &tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);1223 mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir); 1224 1224 write_one_liner_data_file(tmp, bkpinfo->prefix); 1225 1225 mr_free(tmp); … … 1282 1282 if (scratchLL <= 1) { 1283 1283 mds = media_descriptor_string(bkpinfo->backup_media_type); 1284 mr_asprintf( &tmp, "Your backup will probably occupy a single %s. Maybe two.", mds);1284 mr_asprintf(tmp, "Your backup will probably occupy a single %s. Maybe two.", mds); 1285 1285 mr_free(mds); 1286 1286 } else if (scratchLL > 4) { 1287 mr_asprintf( &tmp, "Your backup will occupy one meeeeellion media! (maybe %s)", number_to_text((int) (scratchLL + 1)));1287 mr_asprintf(tmp, "Your backup will occupy one meeeeellion media! (maybe %s)", number_to_text((int) (scratchLL + 1))); 1288 1288 } else { 1289 mr_asprintf( &tmp, "Your backup will occupy approximately %s media.", number_to_text((int) (scratchLL + 1)));1289 mr_asprintf(tmp, "Your backup will occupy approximately %s media.", number_to_text((int) (scratchLL + 1))); 1290 1290 } 1291 1291 if (!bkpinfo->image_devs[0] && (scratchLL < 50)) { … … 1336 1336 } 1337 1337 1338 mr_asprintf( &tmp, "%s/do-not-compress-these", g_mondo_home);1338 mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home); 1339 1339 if (!does_file_exist(tmp)) { 1340 1340 mr_free(tmp); … … 1346 1346 1347 1347 for (p = do_not_compress_these; p != NULL; p++) { 1348 mr_asprintf( &tmp, "%s", p);1348 mr_asprintf(tmp, "%s", p); 1349 1349 if (strchr(tmp, ' ')) { 1350 1350 *(strchr(tmp, ' ')) = '\0'; … … 1394 1394 paranoid_fclose(fout); 1395 1395 log_msg(2, "Created %s", outfile); 1396 mr_asprintf( &tmp, "chmod +x %s", outfile);1396 mr_asprintf(tmp, "chmod +x %s", outfile); 1397 1397 paranoid_system(tmp); 1398 1398 mr_free(tmp); -
branches/2.2.10/mondo/src/common/libmondo-fork.c
r2316 r2323 125 125 126 126 if (bkpinfo->nfs_user) { 127 mr_asprintf( &tmp1, "su - %s -c \"%s\"", bkpinfo->nfs_user, basic_call);127 mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->nfs_user, basic_call); 128 128 } else { 129 mr_asprintf( &tmp1, "%s", basic_call);130 } 131 132 mr_asprintf( &cd_number_str, "%d", cd_no);129 mr_asprintf(tmp1, "%s", basic_call); 130 } 131 132 mr_asprintf(cd_number_str, "%d", cd_no); 133 133 log_msg(4, "basic call = '%s'", tmp1); 134 134 midway_call = resolve_naff_tokens(tmp1, isofile, "_ISO_"); … … 145 145 146 146 log_msg(4, "ultimate call = '%s'", ultimate_call); 147 mr_asprintf( &command, "%s >> %s", ultimate_call, MONDO_LOGFILE);147 mr_asprintf(command, "%s >> %s", ultimate_call, MONDO_LOGFILE); 148 148 mr_free(ultimate_call); 149 149 … … 153 153 what_i_am_doing); 154 154 if (bkpinfo->manual_cd_tray) { 155 mr_asprintf( &tmp2, "%s", command);155 mr_asprintf(tmp2, "%s", command); 156 156 p = strstr(tmp2, "2>>"); 157 157 if (p) { … … 272 272 log_if_failure = TRUE; 273 273 } 274 mr_asprintf( &callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);274 mr_asprintf(callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir); 275 275 while ((p = strchr(callstr, '\r'))) { 276 276 *p = ' '; … … 288 288 mr_free(callstr); 289 289 290 mr_asprintf( &callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);290 mr_asprintf(callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir); 291 291 if (log_if_failure && system(callstr)) { 292 292 log_OS_error("Command failed"); … … 294 294 mr_free(callstr); 295 295 296 mr_asprintf( &tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);296 mr_asprintf(tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir); 297 297 unlink(tmp1); 298 298 mr_free(tmp1); 299 299 300 mr_asprintf( &tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);300 mr_asprintf(tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir); 301 301 fin = fopen(tmp1, "r"); 302 302 if (fin) { … … 363 363 assert_string_is_neither_NULL_nor_zerolength(basic_call); 364 364 365 mr_asprintf( &lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir);366 367 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);365 mr_asprintf(lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir); 366 367 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 368 open_evalcall_form(what_i_am_doing); 369 mr_asprintf( &tmp, "Executing %s", basic_call);369 mr_asprintf(tmp, "Executing %s", basic_call); 370 370 log_msg(2, tmp); 371 371 mr_free(tmp); … … 373 373 if (!(fin = popen(command, "r"))) { 374 374 log_OS_error("Unable to popen-in command"); 375 mr_asprintf( &tmp, "Failed utterly to call '%s'", command);375 mr_asprintf(tmp, "Failed utterly to call '%s'", command); 376 376 log_to_screen(tmp); 377 377 mr_free(tmp); … … 463 463 fin = f_orig; 464 464 fout = f_archived; 465 mr_asprintf( &tmp, "%-64s", PIMP_START_SZ);465 mr_asprintf(tmp, "%-64s", PIMP_START_SZ); 466 466 if (fwrite(tmp, 1, 64, fout) != 64) { 467 467 mr_free(tmp); … … 475 475 break; 476 476 } 477 mr_asprintf( &tmp, "%-64ld", bytes_read_in);477 mr_asprintf(tmp, "%-64ld", bytes_read_in); 478 478 if (fwrite(tmp, 1, 64, fout) != 64) { 479 479 mr_free(tmp); … … 486 486 subsliceno, bytes_read_in, bytes_to_be_read); 487 487 bytes_written_out += fwrite(buf, 1, bytes_read_in, fout); 488 mr_asprintf( &tmp, "%-64ld", subsliceno);488 mr_asprintf(tmp, "%-64ld", subsliceno); 489 489 if (fwrite(tmp, 1, 64, fout) != 64) { 490 490 mr_free(tmp); … … 495 495 subsliceno++; 496 496 } 497 mr_asprintf( &tmp, "%-64ld", 0L);497 mr_asprintf(tmp, "%-64ld", 0L); 498 498 if (fwrite(tmp, 1, 64L, fout) != 64L) { 499 499 mr_free(tmp); … … 502 502 mr_free(tmp); 503 503 504 mr_asprintf( &tmp, "%-64s", PIMP_END_SZ);504 mr_asprintf(tmp, "%-64s", PIMP_END_SZ); 505 505 if (fwrite(tmp, 1, 64, fout) != 64) { 506 506 mr_free(tmp); … … 559 559 log_msg(5, "tmpB is %s", tmp1); 560 560 if (!strstr(tmp1, PIMP_END_SZ)) { 561 mr_asprintf( &filestr, "%s/out.leftover", bkpinfo->tmpdir);561 mr_asprintf(filestr, "%s/out.leftover", bkpinfo->tmpdir); 562 562 ftmp = fopen(filestr, "w"); 563 563 mr_free(filestr); … … 604 604 fatal_error("ntfsclone not found"); 605 605 } 606 mr_asprintf( &command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);606 mr_asprintf(command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device); 607 607 res = run_program_and_log_output(command, 5); 608 608 mr_free(command); … … 659 659 malloc_string(title); 660 660 strcpy(title, tt); 661 mr_asprintf( &command, "%s 2>> %s", cmd, MONDO_LOGFILE);661 mr_asprintf(command, "%s 2>> %s", cmd, MONDO_LOGFILE); 662 662 log_msg(3, "command = '%s'", command); 663 663 if ((res = pthread_create(&childthread, NULL, run_prog_in_bkgd_then_exit, (void *) command))) { … … 719 719 fatal_error("ntfsclone not found"); 720 720 } 721 mr_asprintf( &command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);721 mr_asprintf(command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo); 722 722 res = run_program_and_log_output(command, 5); 723 723 mr_free(command); -
branches/2.2.10/mondo/src/common/libmondo-mountlist.c
r2316 r2323 73 73 /*@ initialize ***************************************************** */ 74 74 prev_part_no = 0; 75 mr_asprintf( &flaws_str, "%s", "");75 mr_asprintf(flaws_str, "%s", ""); 76 76 77 77 … … 79 79 80 80 if (physical_drive_size < 0) { 81 mr_asprintf( &tmp, " %s does not exist.", drive);81 mr_asprintf(tmp, " %s does not exist.", drive); 82 82 mr_strcat(flaws_str, "%s", tmp); 83 83 } else { 84 mr_asprintf( &tmp, "%s is %ld MB", drive, physical_drive_size);84 mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size); 85 85 } 86 86 log_it(tmp); … … 90 90 /* check DD */ 91 91 for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) { 92 mr_asprintf( &device, "%s%c", drive, cur_sp_no);92 mr_asprintf(device, "%s%c", drive, cur_sp_no); 93 93 if (find_device_in_mountlist(mountlist, device) >= 0) { 94 94 foundsome = TRUE; … … 98 98 if (foundsome) { 99 99 for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) { 100 mr_asprintf( &device, "%s%c", drive, cur_sp_no);100 mr_asprintf(device, "%s%c", drive, cur_sp_no); 101 101 pos = find_device_in_mountlist(mountlist, device); 102 102 if (pos < 0) { … … 107 107 /* is it too big? */ 108 108 if (curr_part_no > 'h') { 109 mr_asprintf( &tmp, " Can only have up to 'h' in disklabel.");109 mr_asprintf(tmp, " Can only have up to 'h' in disklabel."); 110 110 log_it(tmp); 111 111 mr_strcat(flaws_str, tmp); … … 121 121 } 122 122 if (device_copies > 1) { 123 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);123 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 124 124 if (!strstr(flaws_str, tmp)) { 125 125 log_it(tmp); … … 132 132 if (mountlist->el[pos].size < 8192 133 133 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 134 mr_asprintf( &tmp, " %s is tiny!", device);134 mr_asprintf(tmp, " %s is tiny!", device); 135 135 log_it(tmp); 136 136 mr_strcat(flaws_str, tmp); … … 145 145 && strcmp(mountlist->el[pos].mountpoint, "none") 146 146 && mountlist->el[pos].mountpoint[0] != '/') { 147 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);147 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 148 148 log_it(tmp); 149 149 mr_strcat(flaws_str, tmp); … … 153 153 /* is format sensible? */ 154 154 if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) { 155 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);155 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 156 156 log_it(tmp); 157 157 mr_strcat(flaws_str, tmp); … … 172 172 npos = 0; 173 173 for (cur_sp_no = 'a'; cur_sp_no <= 'h'; cur_sp_no++) { 174 mr_asprintf( &tmp, "%ss%i%c", device, curr_part_no, cur_sp_no);174 mr_asprintf(tmp, "%ss%i%c", device, curr_part_no, cur_sp_no); 175 175 if (find_device_in_mountlist(mountlist, tmp) >= 0) { 176 176 npos++; … … 191 191 if (curr_part_no - prev_part_no > 1) { 192 192 if (prev_part_no == 0) { 193 mr_asprintf( &tmp, " Gap prior to %s.", device);193 mr_asprintf(tmp, " Gap prior to %s.", device); 194 194 log_it(tmp); 195 195 mr_strcat(flaws_str, "%s", tmp); … … 198 198 } else if (curr_part_no > 5 199 199 || (curr_part_no <= 4 && prev_part_no > 0)) { 200 mr_asprintf( &tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no);200 mr_asprintf(tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no); 201 201 log_it(tmp); 202 202 mr_strcat(flaws_str, "%s", tmp); … … 210 210 if ((curr_part_no >= 5 && prev_part_no == 4) 211 211 && (strcmp(part_table_fmt, "MBR") == 0)) { 212 mr_asprintf( &tmp, " Partition %ss4 is occupied.", drive);212 mr_asprintf(tmp, " Partition %ss4 is occupied.", drive); 213 213 log_it(tmp); 214 214 mr_strcat(flaws_str, "%s", tmp); … … 224 224 } 225 225 if (device_copies > 1) { 226 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);226 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 227 227 if (!strstr(flaws_str, "%s", tmp)) { 228 228 log_it(tmp); … … 235 235 if (mountlist->el[pos].size < 8192 236 236 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 237 mr_asprintf( &tmp, " %s is tiny!", device);237 mr_asprintf(tmp, " %s is tiny!", device); 238 238 log_it(tmp); 239 239 mr_strcat(flaws_str, "%s", tmp); … … 248 248 && strcmp(mountlist->el[pos].mountpoint, "none") 249 249 && mountlist->el[pos].mountpoint[0] != '/') { 250 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);250 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 251 251 log_it(tmp); 252 252 mr_strcat(flaws_str, "%s", tmp); … … 256 256 /* is format sensible? */ 257 257 if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) { 258 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);258 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 259 259 log_it(tmp); 260 260 mr_strcat(flaws_str, "%s", tmp); … … 274 274 /* is it too big? */ 275 275 if (curr_part_no > 'h') { 276 mr_asprintf( &tmp, " Can only have up to 'h' in disklabel.");276 mr_asprintf(tmp, " Can only have up to 'h' in disklabel."); 277 277 log_it(tmp); 278 278 mr_strcat(flaws_str, "%s", tmp); … … 288 288 } 289 289 if (device_copies > 1) { 290 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);290 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 291 291 if (!strstr(flaws_str, tmp)) { 292 292 log_it(tmp); … … 299 299 if (mountlist->el[pos].size < 8192 300 300 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 301 mr_asprintf( &tmp, " %s is tiny!", device);301 mr_asprintf(tmp, " %s is tiny!", device); 302 302 log_it(tmp); 303 303 mr_strcat(flaws_str, "%s", tmp); … … 312 312 && strcmp(mountlist->el[pos].mountpoint, "none") 313 313 && mountlist->el[pos].mountpoint[0] != '/') { 314 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);314 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 315 315 log_it(tmp); 316 316 mr_strcat(flaws_str, "%s", tmp); … … 321 321 if (!is_this_a_valid_disk_format 322 322 (mountlist->el[pos].format)) { 323 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);323 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 324 324 log_it(tmp); 325 325 mr_strcat(flaws_str, "%s", tmp); … … 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.",343 mr_asprintf(tmp, " %ld MB over-allocated on %s.", 344 344 amount_allocated - physical_drive_size, drive); 345 345 log_it(tmp); … … 348 348 res++; 349 349 } else if (amount_allocated < physical_drive_size - 1) { /* NOT AN ERROR, JUST A WARNING :-) */ 350 mr_asprintf( &tmp, " %ld MB unallocated on %s.",350 mr_asprintf(tmp, " %ld MB unallocated on %s.", 351 351 physical_drive_size - amount_allocated, drive); 352 352 log_it(tmp); … … 389 389 assert_string_is_neither_NULL_nor_zerolength(drive); 390 390 assert(mountlist != NULL); 391 mr_asprintf( &flaws_str, "%s", "");391 mr_asprintf(flaws_str, "%s", ""); 392 392 393 393 prev_part_no = 0; … … 396 396 397 397 if (physical_drive_size < 0) { 398 mr_asprintf( &tmp, " %s does not exist.", drive);398 mr_asprintf(tmp, " %s does not exist.", drive); 399 399 mr_strcat(flaws_str, "%s", tmp); 400 400 res++; … … 403 403 return(flaws_str); 404 404 } else { 405 mr_asprintf( &tmp, "%s is %ld MB", drive, physical_drive_size);405 mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size); 406 406 log_it(tmp); 407 407 mr_free(tmp); … … 417 417 if (curr_part_no - prev_part_no > 1) { 418 418 if (prev_part_no == 0) { 419 mr_asprintf( &tmp, " Gap prior to %s.", device);419 mr_asprintf(tmp, " Gap prior to %s.", device); 420 420 log_it(tmp); 421 421 mr_strcat(flaws_str, "%s", tmp); … … 424 424 } else if (curr_part_no > 5 425 425 || (curr_part_no <= 4 && prev_part_no > 0)) { 426 mr_asprintf( &tmp, " Gap on %s between %d and %d.", drive,426 mr_asprintf(tmp, " Gap on %s between %d and %d.", drive, 427 427 prev_part_no, curr_part_no); 428 428 log_it(tmp); … … 437 437 if ((curr_part_no >= 5 && prev_part_no == 4) 438 438 && (strcmp(part_table_fmt, "MBR") == 0)) { 439 mr_asprintf( &tmp, " Partition 4 of %s is occupied.", drive);439 mr_asprintf(tmp, " Partition 4 of %s is occupied.", drive); 440 440 log_it(tmp); 441 441 mr_strcat(flaws_str, "%s", tmp); … … 451 451 } 452 452 if (device_copies > 1) { 453 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);453 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 454 454 if (!strstr(flaws_str, tmp)) { 455 455 log_it(tmp); … … 462 462 if (mountlist->el[pos].size < 8192 463 463 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 464 mr_asprintf( &tmp, " %s is tiny!", device);464 mr_asprintf(tmp, " %s is tiny!", device); 465 465 log_it(tmp); 466 466 mr_strcat(flaws_str, "%s", tmp); … … 474 474 && strcmp(mountlist->el[pos].mountpoint, "image") 475 475 && mountlist->el[pos].mountpoint[0] != '/') { 476 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);476 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 477 477 log_it(tmp); 478 478 mr_strcat(flaws_str, "%s", tmp); … … 482 482 /* is format sensible? */ 483 483 if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) { 484 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);484 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 485 485 log_it(tmp); 486 486 mr_strcat(flaws_str, "%s", tmp); … … 496 496 /* Over-allocated the disk? Unallocated space on disk? */ 497 497 if (amount_allocated > physical_drive_size + 1) { 498 mr_asprintf( &tmp, " %ld MB over-allocated on %s.",498 mr_asprintf(tmp, " %ld MB over-allocated on %s.", 499 499 amount_allocated - physical_drive_size, drive); 500 500 log_it(tmp); … … 503 503 res++; 504 504 } else if (amount_allocated < physical_drive_size - 1) { /* NOT AN ERROR, JUST A WARNING :-) */ 505 mr_asprintf( &tmp, " %ld MB unallocated on %s.",505 mr_asprintf(tmp, " %ld MB unallocated on %s.", 506 506 physical_drive_size - amount_allocated, drive); 507 507 log_it(tmp); … … 551 551 assert(flaws_str_C != NULL); 552 552 553 mr_asprintf( &flaws_str, "%s", "");553 mr_asprintf(flaws_str, "%s", ""); 554 554 555 555 make_list_of_drives_in_mountlist(mountlist, drivelist); … … 561 561 (drivelist->el[i].device, 562 562 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);563 mr_asprintf(tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device); 564 564 log_it(tmp); 565 565 paranoid_free(tmp); … … 639 639 640 640 for (currline = 0; currline < mountlist->entries; currline++) { 641 mr_asprintf( &curr_mountpoint, "%s", mountlist->el[currline].mountpoint);641 mr_asprintf(curr_mountpoint, "%s", mountlist->el[currline].mountpoint); 642 642 for (i = 0, copies = 0, last_copy = -1; i < mountlist->entries; 643 643 i++) { … … 651 651 if (copies > 1 && last_copy == currline 652 652 && strcmp(curr_mountpoint, "raid")) { 653 mr_asprintf( &tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);653 mr_asprintf(tmp, " %s %s's.", number_to_text(copies), curr_mountpoint); 654 654 mr_strcat(flaws_str, "%s", tmp); 655 655 log_it(tmp); … … 690 690 for (lino = 0, noof_drives = 0; lino < mountlist->entries; lino++) { 691 691 692 mr_asprintf( &drive, "%s", mountlist->el[lino].device);692 mr_asprintf(drive, "%s", mountlist->el[lino].device); 693 693 if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) { 694 694 log_msg(8, "Not putting %s in list of drives: it's a virtual drive", drive); … … 777 777 (void *) &mountlist->el[i], 778 778 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);779 mr_asprintf(tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device); 780 780 log_it(tmp); 781 781 paranoid_free(tmp); … … 895 895 if (j < items) { 896 896 strcat(mountlist->el[items].device, "_dup"); 897 mr_asprintf( &tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);897 mr_asprintf(tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device); 898 898 log_it(tmp); 899 899 paranoid_free(tmp); 900 900 } 901 mr_asprintf( &tmp, "%s", mountlist->el[items].device);901 mr_asprintf(tmp, "%s", mountlist->el[items].device); 902 902 if (strstr(tmp, "/dev/md/")) { 903 903 log_it("format_device() --- Contracting %s", tmp); … … 1048 1048 assert(b >= 0); 1049 1049 1050 mr_asprintf( &device, "%s", mountlist->el[a].device);1051 mr_asprintf( &mountpoint, "%s", mountlist->el[a].mountpoint);1052 mr_asprintf( &format, "%s", mountlist->el[a].format);1050 mr_asprintf(device, "%s", mountlist->el[a].device); 1051 mr_asprintf(mountpoint, "%s", mountlist->el[a].mountpoint); 1052 mr_asprintf(format, "%s", mountlist->el[a].format); 1053 1053 1054 1054 size = mountlist->el[a].size; -
branches/2.2.10/mondo/src/common/libmondo-raid.c
r2321 r2323 50 50 int res; 51 51 52 mr_asprintf( &command, "grep \"");52 mr_asprintf(command, "grep \""); 53 53 if (raidno == -1) { 54 54 mr_strcat(command, "linear"); … … 197 197 assert(label != NULL); 198 198 199 mr_asprintf( &sz_value, "%d", value);199 mr_asprintf(sz_value, "%d", value); 200 200 strcpy(raidrec->additional_vars.el[lino].label, label); 201 201 strcpy(raidrec->additional_vars.el[lino].value, sz_value); … … 585 585 fclose(fin); 586 586 log_it("Raidtab loaded successfully."); 587 mr_asprintf( &tmp1, "%d RAID devices in raidtab", raidlist->entries);587 mr_asprintf(tmp1, "%d RAID devices in raidtab", raidlist->entries); 588 588 log_it(tmp1); 589 589 mr_free(tmp1); … … 744 744 } 745 745 if (!disklist) { 746 mr_asprintf( &tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label);746 mr_asprintf(tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label); 747 747 log_it(tmp); 748 748 mr_free(tmp); … … 1006 1006 pos = string; 1007 1007 while (*pos == ' ') pos += 1; 1008 mr_asprintf( &strtmp, "%s", pos);1008 mr_asprintf(strtmp, "%s", pos); 1009 1009 strcpy(string, strtmp); 1010 1010 paranoid_free(strtmp); … … 1027 1027 token = mr_strtok(string, delims, &lastpos); 1028 1028 // get RAID device name 1029 mr_asprintf( &strtmp,"%s%s", device_prefix, token);1029 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1030 1030 strcpy(raidlist->el[raidlist->entries].raid_device, strtmp); 1031 1031 paranoid_free(strtmp); … … 1086 1086 case ' ': // normal data disks 1087 1087 raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].index = atoi(pos + 1); 1088 mr_asprintf( &strtmp,"%s%s", device_prefix, token);1088 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1089 1089 strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp); 1090 1090 paranoid_free(strtmp); … … 1093 1093 case 'S': // spare disks 1094 1094 raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].index = atoi(pos + 1); 1095 mr_asprintf( &strtmp,"%s%s", device_prefix, token);1095 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1096 1096 strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp); 1097 1097 paranoid_free(strtmp); … … 1100 1100 case 'F': // failed disks 1101 1101 raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].index = atoi(pos + 1); 1102 mr_asprintf( &strtmp,"%s%s", device_prefix, token);1102 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1103 1103 strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp); 1104 1104 paranoid_free(strtmp); -
branches/2.2.10/mondo/src/common/libmondo-stream.c
r2321 r2323 236 236 int res; 237 237 238 mr_asprintf( &command, "mt -f %s status", dev);238 mr_asprintf(command, "mt -f %s status", dev); 239 239 res = run_program_and_log_output(command, 1); 240 240 mr_free(command); … … 268 268 mr_asprintf(&cdr_exe, "dvdrecord"); 269 269 } 270 mr_asprintf( &command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", cdr_exe);270 mr_asprintf(command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", cdr_exe); 271 271 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); 272 272 mr_free(command); … … 280 280 mr_free(tmp); 281 281 282 mr_asprintf( &command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1", cdr_exe);282 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1", cdr_exe); 283 283 mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command)); 284 284 mr_free(command); … … 290 290 } 291 291 mr_free(tmp); 292 mr_asprintf( &command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe);292 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe); 293 293 mr_free(cdr_exe); 294 294 … … 372 372 } 373 373 if (strstr(fname, "xattr") == NULL) { 374 mr_asprintf( &tmp,"Wrong order expected xattr, got %s, sunshine.", fname);374 mr_asprintf(tmp,"Wrong order expected xattr, got %s, sunshine.", fname); 375 375 fatal_error(tmp); 376 376 } … … 402 402 } 403 403 if (strstr(fname, "acl") == NULL) { 404 mr_asprintf( &tmp,"Wrong order expected acl, got %s, sunshine.", fname);404 mr_asprintf(tmp,"Wrong order expected acl, got %s, sunshine.", fname); 405 405 fatal_error(tmp); 406 406 } … … 468 468 log_it("Insisting on tape #%d", tapeno); 469 469 if (g_current_media_number != tapeno) { 470 mr_asprintf( &tmp, "When the tape drive goes quiet, please insert volume %d in this series.", tapeno);470 mr_asprintf(tmp, "When the tape drive goes quiet, please insert volume %d in this series.", tapeno); 471 471 popup_and_OK(tmp); 472 472 mr_free(tmp); … … 544 544 fatal_error("Unknown type. Internal error in maintain_collection_of_recent_archives()"); 545 545 } 546 mr_asprintf( &tmpdir, "%s/tmpfs/backcatalog", bkpinfo->tmpdir);546 mr_asprintf(tmpdir, "%s/tmpfs/backcatalog", bkpinfo->tmpdir); 547 547 mkdir(tmpdir, 0x700); 548 mr_asprintf( &command, "cp -f %s %s", latest_fname, tmpdir);548 mr_asprintf(command, "cp -f %s %s", latest_fname, tmpdir); 549 549 if (run_program_and_log_output(command, 6)) { 550 550 log_it("Warning - failed to copy %s to backcatalog at %s", … … 575 575 576 576 for (i = curr - 1; i >= 0 && curr - i < 10; i--) { 577 mr_asprintf( &old_fname, "%s/%s", tmpdir, g_tapecatalog->el[i].fname);577 mr_asprintf(old_fname, "%s/%s", tmpdir, g_tapecatalog->el[i].fname); 578 578 unlink(old_fname); 579 579 mr_free(old_fname); … … 615 615 return (0); 616 616 } 617 mr_asprintf( &tmp, "mt -f %s setblk %ld", bkpinfo->media_device, internal_tape_block_size);617 mr_asprintf(tmp, "mt -f %s setblk %ld", bkpinfo->media_device, internal_tape_block_size); 618 618 res = run_program_and_log_output(tmp, 3); 619 619 mr_free(tmp); … … 684 684 685 685 log_it("Skipping OBDR headers"); 686 mr_asprintf( &command, "mt -f %s rewind",bkpinfo->media_device);686 mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device); 687 687 res = run_program_and_log_output(command, 1); 688 688 paranoid_free(command); 689 689 690 mr_asprintf( &command, "mt -f %s fsf 2",bkpinfo->media_device);690 mr_asprintf(command, "mt -f %s fsf 2",bkpinfo->media_device); 691 691 res = run_program_and_log_output(command, 1); 692 692 paranoid_free(command); … … 711 711 log_it("Creating OBDR headers"); 712 712 /* OBDR: First block 10 kB of zero bs = 512 */ 713 mr_asprintf( &command, "mt -f %s compression off",bkpinfo->media_device);713 mr_asprintf(command, "mt -f %s compression off",bkpinfo->media_device); 714 714 res = run_program_and_log_output(command, 1); 715 715 paranoid_free(command); 716 716 717 mr_asprintf( &command, "mt -f %s rewind",bkpinfo->media_device);717 mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device); 718 718 res += run_program_and_log_output(command, 1); 719 719 paranoid_free(command); … … 721 721 set_tape_block_size_with_mt(512); 722 722 723 mr_asprintf( &command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device);723 mr_asprintf(command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device); 724 724 res += run_program_and_log_output(command, 1); 725 725 paranoid_free(command); … … 728 728 set_tape_block_size_with_mt(2048); 729 729 730 mr_asprintf( &command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device);730 mr_asprintf(command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device); 731 731 res += run_program_and_log_output(command, 1); 732 732 paranoid_free(command); … … 795 795 796 796 insist_on_this_tape_number(1); 797 mr_asprintf( &outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);797 mr_asprintf(outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir); 798 798 make_hole_for_file(outfname); 799 799 … … 858 858 (void) getcwd(old_cwd, MAX_STR_LEN); 859 859 chdir(bkpinfo->tmpdir); 860 mr_asprintf( &tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", outfname);860 mr_asprintf(tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", outfname); 861 861 paranoid_system(tmp); 862 862 mr_free(tmp); … … 885 885 886 886 /* add 'dummy' if testing */ 887 mr_asprintf( &command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE);887 mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE); 888 888 /* initialise the catalog */ 889 889 g_current_media_number = 1; … … 1058 1058 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1059 1059 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);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 1061 log_to_screen(tmp); 1062 1062 mr_free(tmp); … … 1121 1121 log_msg(6, ".......................... Should be %lld", orig_size); 1122 1122 g_tape_posK += total_read_from_tape_for_this_file / 1024; 1123 mr_asprintf( &actual_cksum, "%04x%04x", crc16, crctt);1123 mr_asprintf(actual_cksum, "%04x%04x", crc16, crctt); 1124 1124 if (foutstream) { /*log_it("Finished writing to foutstream"); */ 1125 1125 } else { … … 1131 1131 } 1132 1132 if (strcmp(temp_cksum, actual_cksum)) { 1133 mr_asprintf( &tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum);1133 mr_asprintf(tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum); 1134 1134 log_to_screen(tmp); 1135 1135 mr_free(tmp); 1136 1136 1137 mr_asprintf( &tmp, "%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10);1137 mr_asprintf(tmp, "%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10); 1138 1138 log_to_screen(tmp); 1139 1139 mr_free(tmp); … … 1486 1486 } 1487 1487 if (bkpinfo->backup_media_type == cdstream) { 1488 mr_asprintf( &command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE, MONDO_LOGFILE);1488 mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE, MONDO_LOGFILE); 1489 1489 log_it("Opening OUT to next CD with the command"); 1490 1490 log_it(command); … … 1538 1538 last = g_tapecatalog->entries - 1; 1539 1539 for (i = 0; i <= last; i++) { 1540 mr_asprintf( &fname, "%s/tmpfs/backcatalog/%s", bkpinfo->tmpdir, g_tapecatalog->el[i].fname);1540 mr_asprintf(fname, "%s/tmpfs/backcatalog/%s", bkpinfo->tmpdir, g_tapecatalog->el[i].fname); 1541 1541 if (!does_file_exist(fname)) { 1542 1542 log_msg(6, "Can't write %s - it doesn't exist.", fname); … … 1591 1591 log_it("Data disks = %s", fname); 1592 1592 if (!does_file_exist(fname)) { 1593 mr_asprintf( &tmp, "Cannot find %s", fname);1593 mr_asprintf(tmp, "Cannot find %s", fname); 1594 1594 log_to_screen(tmp); 1595 1595 mr_free(tmp); … … 1689 1689 p++; 1690 1690 } 1691 mr_asprintf( &tmp, "Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10);1691 mr_asprintf(tmp, "Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10); 1692 1692 log_it(tmp); 1693 1693 mr_free(tmp); … … 1731 1731 } 1732 1732 paranoid_fclose(fin); 1733 mr_asprintf( &checksum, "%04x%04x", crc16, crctt);1733 mr_asprintf(checksum, "%04x%04x", crc16, crctt); 1734 1734 /* BERLIOS: what does it do ??? */ 1735 1735 write_header_block_to_stream((off_t)g_current_media_number, checksum, BLK_STOP_FILE); … … 1794 1794 fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, 1795 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);1796 mr_asprintf(tmp, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10); 1797 1797 log_msg(6, tmp); 1798 1798 mr_free(tmp); … … 1821 1821 1822 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));1823 mr_asprintf(tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is)); 1824 1824 log_to_screen(tmp); 1825 1825 mr_free(tmp); -
branches/2.2.10/mondo/src/common/libmondo-string.c
r2322 r2323 45 45 assert(partno >= 0); 46 46 47 mr_asprintf( &partition, drive);47 mr_asprintf(partition, drive); 48 48 /* is this a devfs device path? */ 49 49 c = strrchr(partition, '/'); … … 241 241 fatal_error("Integer overflow."); 242 242 } else if (ch != 'm' && ch != 'M') { 243 mr_asprintf( &tmp1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch);243 mr_asprintf(tmp1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch); 244 244 fatal_error(tmp1); 245 245 } … … 420 420 p = ' '; 421 421 } 422 mr_asprintf( &output, "%d %s disk%c", noof_disks, label, p);422 mr_asprintf(output, "%d %s disk%c", noof_disks, label, p); 423 423 while (strlen(output) < 14) { 424 424 mr_strcat(output, " "); … … 511 511 mr_strcat(output, "%s%s", q, value); 512 512 } else { 513 mr_asprintf( &output, "%s%s", q, value);513 mr_asprintf(output, "%s%s", q, value); 514 514 } 515 515 p+= strlen(token); … … 520 520 } else { 521 521 /* just in case the token doesn't appear in string at all */ 522 mr_asprintf( &output, "%s", q);522 mr_asprintf(output, "%s", q); 523 523 } 524 524 return(output); … … 555 555 assert_string_is_neither_NULL_nor_zerolength(path); 556 556 if (s[0] != '\0') { 557 mr_asprintf( &suffix, ".%s", s);557 mr_asprintf(suffix, ".%s", s); 558 558 } else { 559 mr_asprintf( &suffix, "");559 mr_asprintf(suffix, ""); 560 560 } 561 561 sprintf(output, "%s/slice-%07ld.%05ld.dat%s", path, bigfileno, sliceno, suffix); … … 622 622 if (strlen(flaws_str) > 0) { 623 623 paranoid_free(flaws_str_A); 624 mr_asprintf( &flaws_str_A, "%s", flaws_str + 1);624 mr_asprintf(flaws_str_A, "%s", flaws_str + 1); 625 625 } 626 626 if (strlen(flaws_str_A) >= 74) { 627 627 for (i = 74; flaws_str_A[i] != ' '; i--); 628 628 paranoid_free(flaws_str_B); 629 mr_asprintf( &flaws_str_B, "%s", flaws_str_A + i + 1);629 mr_asprintf(flaws_str_B, "%s", flaws_str_A + i + 1); 630 630 flaws_str_A[i] = '\0'; 631 631 } … … 633 633 for (i = 74; flaws_str_B[i] != ' '; i--); 634 634 paranoid_free(flaws_str_C); 635 mr_asprintf( &flaws_str_C, "%s", flaws_str_B + i + 1);635 mr_asprintf(flaws_str_C, "%s", flaws_str_B + i + 1); 636 636 flaws_str_B[i] = '\0'; 637 637 } … … 830 830 831 831 assert_string_is_neither_NULL_nor_zerolength(partition); 832 mr_asprintf( &trunc, "%s", partition);832 mr_asprintf(trunc, "%s", partition); 833 833 834 834 #ifdef __FreeBSD__ … … 931 931 assert_string_is_neither_NULL_nor_zerolength(fn); 932 932 if (!strncmp(fn, MNT_RESTORING, strlen(MNT_RESTORING))) { 933 mr_asprintf( &filename, "%s", fn + strlen(MNT_RESTORING));933 mr_asprintf(filename, "%s", fn + strlen(MNT_RESTORING)); 934 934 } else if (fn[0] != '/') { 935 mr_asprintf( &filename, "/%s", fn);935 mr_asprintf(filename, "/%s", fn); 936 936 } else { 937 mr_asprintf( &filename, "%s", fn);937 mr_asprintf(filename, "%s", fn); 938 938 } 939 939 940 940 sev = 3; 941 mr_asprintf( &reason, "Changed since backup. Consider running a differential backup in a day or two.");941 mr_asprintf(reason, "Changed since backup. Consider running a differential backup in a day or two."); 942 942 943 943 if (!strncmp(filename, "/var/", 5)) { 944 944 sev = 2; 945 945 mr_free(reason); 946 mr_asprintf( &reason, "/var's contents will change regularly, inevitably.");946 mr_asprintf(reason, "/var's contents will change regularly, inevitably."); 947 947 } 948 948 if (!strncmp(filename, "/home", 5)) { 949 949 sev = 2; 950 950 mr_free(reason); 951 mr_asprintf( &reason, "It's in your /home directory. Therefore, it is important.");951 mr_asprintf(reason, "It's in your /home directory. Therefore, it is important."); 952 952 } 953 953 if (!strncmp(filename, "/usr/", 5)) { 954 954 sev = 3; 955 955 mr_free(reason); 956 mr_asprintf( &reason, "You may have installed/removed software during the backup.");956 mr_asprintf(reason, "You may have installed/removed software during the backup."); 957 957 } 958 958 if (!strncmp(filename, "/etc/", 5)) { 959 959 sev = 3; 960 960 mr_free(reason); 961 mr_asprintf( &reason, "Do not edit config files while backing up your PC.");961 mr_asprintf(reason, "Do not edit config files while backing up your PC."); 962 962 } 963 963 if (!strcmp(filename, "/etc/adjtime") … … 965 965 sev = 1; 966 966 mr_free(reason); 967 mr_asprintf( &reason, "This file changes all the time. It's OK.");967 mr_asprintf(reason, "This file changes all the time. It's OK."); 968 968 } 969 969 if (!strncmp(filename, "/root/", 6)) { 970 970 sev = 3; 971 971 mr_free(reason); 972 mr_asprintf( &reason, "Were you compiling/editing something in /root?");972 mr_asprintf(reason, "Were you compiling/editing something in /root?"); 973 973 } 974 974 if (!strncmp(filename, "/root/.", 7)) { 975 975 sev = 2; 976 976 mr_free(reason); 977 mr_asprintf( &reason, "Temp or 'dot' files changed in /root.");977 mr_asprintf(reason, "Temp or 'dot' files changed in /root."); 978 978 } 979 979 if (!strncmp(filename, "/var/lib/", 9)) { 980 980 sev = 2; 981 981 mr_free(reason); 982 mr_asprintf( &reason, "Did you add/remove software during backing?");982 mr_asprintf(reason, "Did you add/remove software during backing?"); 983 983 } 984 984 if (!strncmp(filename, "/var/lib/rpm", 12)) { 985 985 sev = 3; 986 986 mr_free(reason); 987 mr_asprintf( &reason, "Did you add/remove software during backing?");987 mr_asprintf(reason, "Did you add/remove software during backing?"); 988 988 } 989 989 if (!strncmp(filename, "/var/lib/slocate", 16)) { 990 990 sev = 1; 991 991 mr_free(reason); 992 mr_asprintf( &reason, "The 'update' daemon ran during backup. This does not affect the integrity of your backup.");992 mr_asprintf(reason, "The 'update' daemon ran during backup. This does not affect the integrity of your backup."); 993 993 } 994 994 if (!strncmp(filename, "/var/log/", 9) … … 997 997 sev = 1; 998 998 mr_free(reason); 999 mr_asprintf( &reason, "Log files change frequently as the computer runs. Fret not.");999 mr_asprintf(reason, "Log files change frequently as the computer runs. Fret not."); 1000 1000 } 1001 1001 if (!strncmp(filename, "/var/spool", 10)) { 1002 1002 sev = 1; 1003 1003 mr_free(reason); 1004 mr_asprintf( &reason, "Background processes or printers were active. This does not affect the integrity of your backup.");1004 mr_asprintf(reason, "Background processes or printers were active. This does not affect the integrity of your backup."); 1005 1005 } 1006 1006 if (!strncmp(filename, "/var/spool/mail", 10)) { 1007 1007 sev = 2; 1008 1008 mr_free(reason); 1009 mr_asprintf( &reason, "Mail was sent/received during backup.");1009 mr_asprintf(reason, "Mail was sent/received during backup."); 1010 1010 } 1011 1011 if (filename[strlen(filename) - 1] == '~') { 1012 1012 sev = 1; 1013 1013 mr_free(reason); 1014 mr_asprintf( &reason, "Backup copy of another file which was modified recently.");1014 mr_asprintf(reason, "Backup copy of another file which was modified recently."); 1015 1015 } 1016 1016 if (strstr(filename, "cache")) { 1017 1017 sev = 1; 1018 1018 mr_free(reason); 1019 mr_asprintf( &reason, "Part of a cache of data. Caches change from time to time. Don't worry.");1019 mr_asprintf(reason, "Part of a cache of data. Caches change from time to time. Don't worry."); 1020 1020 } 1021 1021 if (!strncmp(filename, "/var/run/", 9) … … 1025 1025 sev = 1; 1026 1026 mr_free(reason); 1027 mr_asprintf( &reason, "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence.");1027 mr_asprintf(reason, "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence."); 1028 1028 } 1029 1029 if (out_reason) { … … 1088 1088 1089 1089 if (bkpinfo->media_size[g_current_media_number] <= 0) { 1090 mr_asprintf( &tmp, "%lld", g_tape_posK);1091 mr_asprintf( &pos_w_commas, "%s", commarize(tmp));1090 mr_asprintf(tmp, "%lld", g_tape_posK); 1091 mr_asprintf(pos_w_commas, "%s", commarize(tmp)); 1092 1092 mr_free(tmp); 1093 mr_asprintf( &outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas);1093 mr_asprintf(outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas); 1094 1094 mr_free(pos_w_commas); 1095 1095 return (outstr); … … 1104 1104 percentage = 100; 1105 1105 } 1106 mr_asprintf( &outstr, "Volume %d: [", g_current_media_number);1106 mr_asprintf(outstr, "Volume %d: [", g_current_media_number); 1107 1107 } else { 1108 1108 percentage = … … 1110 1110 bkpinfo->media_size[g_current_media_number]); 1111 1111 mds = media_descriptor_string(bkpinfo->backup_media_type); 1112 mr_asprintf( &outstr, "%s %d: [", mds, g_current_media_number);1112 mr_asprintf(outstr, "%s %d: [", mds, g_current_media_number); 1113 1113 mr_free(mds); 1114 1114 } … … 1136 1136 switch (type_of_bkp) { 1137 1137 case dvd: 1138 mr_asprintf( &type_of_backup, "DVD");1138 mr_asprintf(type_of_backup, "DVD"); 1139 1139 break; 1140 1140 case cdr: 1141 mr_asprintf( &type_of_backup, "CDR");1141 mr_asprintf(type_of_backup, "CDR"); 1142 1142 break; 1143 1143 case cdrw: 1144 mr_asprintf( &type_of_backup, "CDRW");1144 mr_asprintf(type_of_backup, "CDRW"); 1145 1145 break; 1146 1146 case tape: 1147 mr_asprintf( &type_of_backup, "tape");1147 mr_asprintf(type_of_backup, "tape"); 1148 1148 break; 1149 1149 case cdstream: 1150 mr_asprintf( &type_of_backup, "CDR");1150 mr_asprintf(type_of_backup, "CDR"); 1151 1151 break; 1152 1152 case udev: 1153 mr_asprintf( &type_of_backup, "udev");1153 mr_asprintf(type_of_backup, "udev"); 1154 1154 break; 1155 1155 case iso: 1156 mr_asprintf( &type_of_backup, "ISO");1156 mr_asprintf(type_of_backup, "ISO"); 1157 1157 break; 1158 1158 case nfs: 1159 mr_asprintf( &type_of_backup, "nfs");1159 mr_asprintf(type_of_backup, "nfs"); 1160 1160 break; 1161 1161 case usb: 1162 mr_asprintf( &type_of_backup, "USB");1162 mr_asprintf(type_of_backup, "USB"); 1163 1163 break; 1164 1164 default: 1165 mr_asprintf( &type_of_backup, "ISO");1165 mr_asprintf(type_of_backup, "ISO"); 1166 1166 } 1167 1167 return (type_of_backup); -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2322 r2323 219 219 220 220 uname(&utsn); 221 mr_asprintf( &tmp, "%s", utsn.machine);221 mr_asprintf(tmp, "%s", utsn.machine); 222 222 return (tmp); 223 223 } … … 449 449 if (bkpinfo->backup_media_type == tape) { 450 450 log_msg(1, "Bar"); 451 mr_asprintf( &tmp, "mt -f %s status", bkpinfo->media_device);451 mr_asprintf(tmp, "mt -f %s status", bkpinfo->media_device); 452 452 log_msg(1, "tmp = '%s'", tmp); 453 453 if (run_program_and_log_output(tmp, 3)) { … … 501 501 } 502 502 if (bkpinfo->nonbootable_backup) { 503 mr_asprintf( &mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);503 mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT); 504 504 } else if 505 505 #ifdef __FreeBSD__ … … 510 510 #ifdef __IA64__ 511 511 { 512 mr_asprintf( &mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO);512 mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO); 513 513 } 514 514 #else 515 515 { 516 mr_asprintf( &mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO);516 mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO); 517 517 } 518 518 #endif 519 519 else 520 520 { 521 mr_asprintf( &mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX);521 mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX); 522 522 } 523 523 if (bkpinfo->manual_cd_tray) { … … 533 533 } 534 534 if (getenv ("SUDO_COMMAND")) { 535 mr_asprintf( &command, "strings `which growisofs` | grep -c SUDO_COMMAND");535 mr_asprintf(command, "strings `which growisofs` | grep -c SUDO_COMMAND"); 536 536 if (!strcmp(call_program_and_get_last_line_of_output(command), "1")) { 537 537 mr_free(command); … … 549 549 || bkpinfo->backup_media_type == cdr) { 550 550 if (!bkpinfo->manual_cd_tray) { 551 mr_asprintf( &extra_cdrom_params, "-waiti ");551 mr_asprintf(extra_cdrom_params, "-waiti "); 552 552 } 553 553 if (bkpinfo->backup_media_type == cdrw) { 554 mr_asprintf( &extra_cdrom_params, "blank=fast ");554 mr_asprintf(extra_cdrom_params, "blank=fast "); 555 555 } 556 556 if (find_home_of_exe("cdrecord")) { … … 562 562 } 563 563 if (bkpinfo->nonbootable_backup) { 564 mr_asprintf( &mondo_mkisofs_sz, MONDO_MKISOFS_NONBOOT);564 mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_NONBOOT); 565 565 } else if 566 566 #ifdef __FreeBSD__ … … 571 571 #ifdef __IA64__ 572 572 { 573 mr_asprintf( &mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_ELILO);573 mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_ELILO); 574 574 } 575 575 #else 576 576 { 577 mr_asprintf( &mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_LILO);577 mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_LILO); 578 578 } 579 579 #endif 580 580 else 581 581 { 582 mr_asprintf( &mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX);582 mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX); 583 583 } 584 584 if (bkpinfo->manual_cd_tray) { … … 621 621 622 622 log_it("isodir = %s", bkpinfo->isodir); 623 mr_asprintf( &command, "df -P %s | tail -n1 | cut -d' ' -f1", bkpinfo->isodir);623 mr_asprintf(command, "df -P %s | tail -n1 | cut -d' ' -f1", bkpinfo->isodir); 624 624 log_it("command = %s", command); 625 625 log_it("res of it = %s", call_program_and_get_last_line_of_output(command)); 626 mr_asprintf( &iso_dev, "%s", call_program_and_get_last_line_of_output(command));627 mr_asprintf( &tmp, "%s/ISO-DEV", bkpinfo->tmpdir);626 mr_asprintf(iso_dev, "%s", call_program_and_get_last_line_of_output(command)); 627 mr_asprintf(tmp, "%s/ISO-DEV", bkpinfo->tmpdir); 628 628 write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command)); 629 629 mr_free(tmp); 630 630 mr_free(command); 631 631 632 mr_asprintf( &command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", iso_dev);632 mr_asprintf(command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", iso_dev); 633 633 mr_free(iso_dev); 634 634 635 635 log_it("command = %s", command); 636 636 log_it("res of it = %s", call_program_and_get_last_line_of_output(command)); 637 mr_asprintf( &iso_mnt, "%s", call_program_and_get_last_line_of_output(command));638 mr_asprintf( &tmp, "%s/ISO-MNT", bkpinfo->tmpdir);637 mr_asprintf(iso_mnt, "%s", call_program_and_get_last_line_of_output(command)); 638 mr_asprintf(tmp, "%s/ISO-MNT", bkpinfo->tmpdir); 639 639 write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command)); 640 640 mr_free(tmp); … … 642 642 643 643 log_it("isomnt: %s, %d", iso_mnt, strlen(iso_mnt)); 644 mr_asprintf( &iso_tmp, "%s", bkpinfo->isodir);644 mr_asprintf(iso_tmp, "%s", bkpinfo->isodir); 645 645 if (strlen(iso_tmp) < strlen(iso_mnt)) { 646 mr_asprintf( &iso_path, "%s", "");646 mr_asprintf(iso_path, "%s", ""); 647 647 } else { 648 mr_asprintf( &iso_path, "%s", iso_tmp + strlen(iso_mnt));648 mr_asprintf(iso_path, "%s", iso_tmp + strlen(iso_mnt)); 649 649 } 650 650 mr_free(iso_tmp); 651 651 652 mr_asprintf( &tmp, "%s/ISODIR", bkpinfo->tmpdir);652 mr_asprintf(tmp, "%s/ISODIR", bkpinfo->tmpdir); 653 653 write_one_liner_data_file(tmp, iso_path); 654 654 mr_free(tmp); … … 657 657 mr_free(iso_path); 658 658 659 mr_asprintf( &tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);659 mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir); 660 660 write_one_liner_data_file(tmp, bkpinfo->prefix); 661 661 mr_free(tmp); … … 682 682 retval++; 683 683 } else { 684 mr_asprintf( &ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));684 mr_asprintf(ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr))); 685 685 mr_strcat(ip_address, strchr(bkpinfo->nfs_mount, ':')); 686 686 strcpy(bkpinfo->nfs_mount, ip_address); … … 696 696 } 697 697 if (bkpinfo->include_paths == NULL) { 698 mr_asprintf( &p, "/");698 mr_asprintf(p, "/"); 699 699 bkpinfo->include_paths = p; 700 700 } … … 732 732 733 733 unlink(MONDO_TRACEFILE); 734 mr_asprintf( &tmp,"rm -Rf %s/changed.files*",MONDO_CACHE);734 mr_asprintf(tmp,"rm -Rf %s/changed.files*",MONDO_CACHE); 735 735 run_program_and_log_output(tmp, FALSE); 736 736 paranoid_free(tmp); … … 758 758 /* purging a potential old tmpdir */ 759 759 log_it("Purging old tmpdir %s", bkpinfo->tmpdir); 760 mr_asprintf( &tmp,"rm -Rf %s",bkpinfo->tmpdir);760 mr_asprintf(tmp,"rm -Rf %s",bkpinfo->tmpdir); 761 761 mr_free(bkpinfo->tmpdir); 762 762 (void)system(tmp); … … 765 765 766 766 if (path != NULL) { 767 mr_asprintf( &tmp, "%s/mondo.tmp.XXXXXX", path);767 mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", path); 768 768 } else if (getenv("TMPDIR")) { 769 mr_asprintf( &tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR"));769 mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR")); 770 770 } else if (getenv("TMP")) { 771 mr_asprintf( &tmp, "%s/mondo.tmp.XXXXXX", getenv("TMP"));771 mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", getenv("TMP")); 772 772 } else { 773 mr_asprintf( &tmp, "/tmp/mondo.tmp.XXXXXX");773 mr_asprintf(tmp, "/tmp/mondo.tmp.XXXXXX"); 774 774 } 775 775 p = mkdtemp(tmp); … … 821 821 bkpinfo->use_lzo = FALSE; 822 822 bkpinfo->use_gzip = FALSE; 823 bkpinfo->do_not_compress_these[0] = '\0';824 823 bkpinfo->verify_data = FALSE; 825 824 bkpinfo->backup_data = FALSE; … … 829 828 bkpinfo->disaster_recovery = (am_I_in_disaster_recovery_mode()? TRUE : FALSE); 830 829 if (bkpinfo->disaster_recovery) { 831 strcpy(bkpinfo->isodir, "/");830 mr_asprintf(p, "%s", "/"); 832 831 } else { 833 strcpy(bkpinfo->isodir, MONDO_CACHE); 834 } 835 mr_asprintf(&p, "%s", STD_PREFIX); 832 mr_asprintf(p, "%s", MONDO_CACHE); 833 } 834 bkpinfo->isodir = p; 835 mr_asprintf(p, "%s", STD_PREFIX); 836 836 bkpinfo->prefix = p; 837 837 bkpinfo->scratchdir = NULL; … … 882 882 assert_string_is_neither_NULL_nor_zerolength(partition); 883 883 884 mr_asprintf( &command, "df -m -P %s 1> /dev/null 2> /dev/null", partition);884 mr_asprintf(command, "df -m -P %s 1> /dev/null 2> /dev/null", partition); 885 885 if (system(command)) { 886 886 mr_free(command); … … 889 889 mr_free(command); 890 890 891 mr_asprintf( &command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4",891 mr_asprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4", 892 892 partition); 893 mr_asprintf( &out_sz, "%s", call_program_and_get_last_line_of_output(command));893 mr_asprintf(out_sz, "%s", call_program_and_get_last_line_of_output(command)); 894 894 mr_free(command); 895 895 … … 935 935 ("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE); 936 936 } 937 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));937 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output ("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2")); 938 938 if (atol(tmp) < 35000) { 939 939 retval++; … … 1006 1006 run_program_and_log_output 1007 1007 ("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5); 1008 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output("mount | grep -E \"cdr(om|w)\""));1008 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("mount | grep -E \"cdr(om|w)\"")); 1009 1009 if (strcmp("", tmp)) { 1010 1010 if (strstr(tmp, "autofs")) { … … 1039 1039 fatal_error("Please reinstall Mondo and Mindi."); 1040 1040 } 1041 mr_asprintf( &tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir);1041 mr_asprintf(tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir); 1042 1042 if (run_program_and_log_output(tmp, 5)) { 1043 1043 mr_free(tmp); 1044 mr_asprintf( &tmp, "mindi --makemountlist %s/mountlist.txt.test failed for some reason.", bkpinfo->tmpdir);1044 mr_asprintf(tmp, "mindi --makemountlist %s/mountlist.txt.test failed for some reason.", bkpinfo->tmpdir); 1045 1045 log_to_screen(tmp); 1046 1046 log_to_screen … … 1087 1087 assert_string_is_neither_NULL_nor_zerolength(label); 1088 1088 if (!does_file_exist(config_file)) { 1089 mr_asprintf( &tmp, "(read_cfg_var) Cannot find %s config file", config_file);1089 mr_asprintf(tmp, "(read_cfg_var) Cannot find %s config file", config_file); 1090 1090 log_to_screen(tmp); 1091 1091 mr_free(tmp); … … 1097 1097 return (0); 1098 1098 } else { 1099 mr_asprintf( &command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file);1099 mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file); 1100 1100 strcpy(value, call_program_and_get_last_line_of_output(command)); 1101 1101 mr_free(command); … … 1180 1180 log_msg(3, "%s --- autofs detected", g_autofs_exe); 1181 1181 // FIXME -- only disable it if it's running --- sprintf(tmp, "%s status", autofs_exe); 1182 mr_asprintf( &tmp, "%s stop", g_autofs_exe);1182 mr_asprintf(tmp, "%s stop", g_autofs_exe); 1183 1183 if (run_program_and_log_output(tmp, 2)) { 1184 1184 log_it("Failed to stop autofs - I assume it wasn't running"); … … 1202 1202 return; 1203 1203 } 1204 mr_asprintf( &tmp, "%s start", g_autofs_exe);1204 mr_asprintf(tmp, "%s start", g_autofs_exe); 1205 1205 if (run_program_and_log_output(tmp, 2)) { 1206 1206 log_it("Failed to start autofs"); … … 1225 1225 g_boot_mountpt[0] = '\0'; 1226 1226 log_msg(4, "Done. Great. Seeting command to something"); 1227 mr_asprintf( &command, "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[ ]/boot[ ]\" | tr -s ' ' '\t' | cut -f1 | head -n1");1227 mr_asprintf(command, "%s", "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[ ]/boot[ ]\" | tr -s ' ' '\t' | cut -f1 | head -n1"); 1228 1228 log_msg(4, "Cool. Command = '%s'", command); 1229 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1229 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1230 1230 mr_free(command); 1231 1231 … … 1233 1233 if (tmp[0]) { 1234 1234 log_it("/boot is at %s according to /etc/fstab", tmp); 1235 mr_asprintf( &command, "mount | grep -Ew '/boot'");1235 mr_asprintf(command, "mount | grep -Ew '/boot'"); 1236 1236 mr_free(tmp); 1237 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1237 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1238 1238 mr_free(command); 1239 1239 … … 1247 1247 } 1248 1248 } else { 1249 mr_asprintf( &command, "mount | grep -E '^%s'", tmp);1249 mr_asprintf(command, "mount | grep -E '^%s'", tmp); 1250 1250 log_msg(3, "command = %s", command); 1251 1251 if (run_program_and_log_output(command, 5)) { 1252 1252 strcpy(g_boot_mountpt, tmp); 1253 1253 mr_free(tmp); 1254 mr_asprintf( &tmp, "%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt);1254 mr_asprintf(tmp, "%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt); 1255 1255 log_it(tmp); 1256 1256 mr_free(tmp); 1257 1257 1258 mr_asprintf( &tmp, "mount %s", g_boot_mountpt);1258 mr_asprintf(tmp, "mount %s", g_boot_mountpt); 1259 1259 if (run_program_and_log_output(tmp, 5)) { 1260 1260 g_boot_mountpt[0] = '\0'; … … 1287 1287 log_msg(3, "starting"); 1288 1288 if (g_boot_mountpt[0]) { 1289 mr_asprintf( &tmp, "umount %s", g_boot_mountpt);1289 mr_asprintf(tmp, "umount %s", g_boot_mountpt); 1290 1290 if (run_program_and_log_output(tmp, 5)) { 1291 1291 log_it("WARNING - unable to unmount /boot"); … … 1319 1319 assert(value != NULL); 1320 1320 if (!does_file_exist(config_file)) { 1321 mr_asprintf( &tmp, "(write_cfg_file) Cannot find %s config file", config_file);1321 mr_asprintf(tmp, "(write_cfg_file) Cannot find %s config file", config_file); 1322 1322 log_to_screen(tmp); 1323 1323 mr_free(tmp); 1324 1324 return (1); 1325 1325 } 1326 mr_asprintf( &tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir);1326 mr_asprintf(tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir); 1327 1327 if (does_file_exist(config_file)) { 1328 mr_asprintf( &command, "grep -vE '^%s .*$' %s > %s", label, config_file, tempfile);1328 mr_asprintf(command, "grep -vE '^%s .*$' %s > %s", label, config_file, tempfile); 1329 1329 paranoid_system(command); 1330 1330 mr_free(command); 1331 1331 } 1332 mr_asprintf( &command, "echo \"%s %s\" >> %s", label, value, tempfile);1332 mr_asprintf(command, "echo \"%s %s\" >> %s", label, value, tempfile); 1333 1333 paranoid_system(command); 1334 1334 mr_free(command); 1335 1335 1336 mr_asprintf( &command, "mv -f %s %s", tempfile, config_file);1336 mr_asprintf(command, "mv -f %s %s", tempfile, config_file); 1337 1337 paranoid_system(command); 1338 1338 mr_free(command); … … 1463 1463 1464 1464 if (g_magicdev_command && g_magicdev_command[0]) { 1465 mr_asprintf( &tmp, "%s &", g_magicdev_command);1465 mr_asprintf(tmp, "%s &", g_magicdev_command); 1466 1466 paranoid_system(tmp); 1467 1467 mr_free(tmp); -
branches/2.2.10/mondo/src/common/libmondo-verify.c
r2321 r2323 93 93 assert_string_is_neither_NULL_nor_zerolength(stderr_fname); 94 94 95 mr_asprintf( &afio_found_changes, "%s.afio", ignorefiles_fname);95 mr_asprintf(afio_found_changes, "%s.afio", ignorefiles_fname); 96 96 paranoid_system("sync"); 97 97 98 98 log_msg(1, "Now scanning log file for 'afio: ' stuff"); 99 mr_asprintf( &command, "grep \"afio: \" %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);99 mr_asprintf(command, "grep \"afio: \" %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes); 100 100 log_msg(2, command); 101 101 res = system(command); … … 107 107 108 108 log_msg(1, "Now scanning log file for 'star: ' stuff"); 109 mr_asprintf( &command, "grep \"star: \" %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);109 mr_asprintf(command, "grep \"star: \" %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes); 110 110 log_msg(2, command); 111 111 res = system(command); … … 116 116 } 117 117 afio_diffs = count_lines_in_file(afio_found_changes); 118 mr_asprintf( &command, "sort %s %s %s | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s", ignorefiles_fname, afio_found_changes, afio_found_changes, changedfiles_fname);118 mr_asprintf(command, "sort %s %s %s | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s", ignorefiles_fname, afio_found_changes, afio_found_changes, changedfiles_fname); 119 119 mr_free(afio_found_changes); 120 120 log_msg(2, command); … … 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);169 mr_asprintf(tmp, "Warning - missing set(s) between %d and %d\n", g_last_afioball_number, set_number - 1); 170 170 log_to_screen(tmp); 171 171 mr_free(tmp); … … 173 173 } 174 174 mds = media_descriptor_string(bkpinfo->backup_media_type); 175 mr_asprintf( &tmp, "Verifying %s #%d's tarballs", mds, g_current_media_number);175 mr_asprintf(tmp, "Verifying %s #%d's tarballs", mds, g_current_media_number); 176 176 mr_free(mds); 177 177 … … 269 269 log_it("before vsbf"); 270 270 mds = media_descriptor_string(bkpinfo->backup_media_type); 271 mr_asprintf( &tmp, "Verifying %s#%d's big files", mds, g_current_media_number);271 mr_asprintf(tmp, "Verifying %s#%d's big files", mds, g_current_media_number); 272 272 mr_free(mds); 273 273 … … 276 276 277 277 log_it("after vsbf"); 278 mr_asprintf( &mountpoint, "%s/archives", mtpt);278 mr_asprintf(mountpoint, "%s/archives", mtpt); 279 279 if (last_bigfile_num == -1) { 280 280 bigfile_num = 0; … … 302 302 paranoid_fclose(fin); 303 303 } 304 mr_asprintf( &tmp, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);304 mr_asprintf(tmp, "%s/%s", bkpinfo->restore_path, biggiestruct.filename); 305 305 log_msg(2, "Opening biggiefile #%ld - '%s'", bigfile_num, tmp); 306 306 forig = fopen(tmp, "r"); … … 312 312 bkpinfo->restore_path, 313 313 biggiestruct.filename); 314 mr_asprintf( &tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", bkpinfo->restore_path, biggiestruct.filename, bkpinfo->tmpdir);314 mr_asprintf(tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", bkpinfo->restore_path, biggiestruct.filename, bkpinfo->tmpdir); 315 315 system(tmp); 316 316 mr_free(tmp); … … 333 333 g_current_media_number, bigfile_num, slice_num); 334 334 if (!does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, ""))) { 335 mr_asprintf( &command, "%s -dc %s 2>> %s", sz_exe, slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix), MONDO_LOGFILE);335 mr_asprintf(command, "%s -dc %s 2>> %s", sz_exe, slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix), MONDO_LOGFILE); 336 336 } else { 337 mr_asprintf( &command, "cat %s 2>> %s", slice_fname(bigfile_num, slice_num, mountpoint, ""), MONDO_LOGFILE);337 mr_asprintf(command, "cat %s 2>> %s", slice_fname(bigfile_num, slice_num, mountpoint, ""), MONDO_LOGFILE); 338 338 } 339 339 pin = popen(command, "r"); … … 432 432 433 433 log_it("Verifying fileset '%s'", tarball_fname); 434 mr_asprintf( &outlog, "%s/afio.log", bkpinfo->tmpdir);434 mr_asprintf(outlog, "%s/afio.log", bkpinfo->tmpdir); 435 435 /* if programmer forgot to say which compression thingy to use then find out */ 436 436 if (strstr(tarball_fname, ".lzo") … … 462 462 bkpinfo->use_star = TRUE; 463 463 if (strstr(tarball_fname, ".bz2")) 464 mr_asprintf( &command, "star -diff diffopts=mode,size,data file=%s -bz >> %s 2>> %s", tarball_fname, outlog, outlog);464 mr_asprintf(command, "star -diff diffopts=mode,size,data file=%s %s >> %s 2>> %s", tarball_fname, (strstr(tarball_fname, ".bz2")) ? "-bz" : " ", outlog, outlog); 465 465 } else { 466 466 bkpinfo->use_star = FALSE; 467 mr_asprintf( &command, "afio -r -P %s -Z %s >> %s 2>> %s", bkpinfo->zip_exe, tarball_fname, outlog, outlog);467 mr_asprintf(command, "afio -r -P %s -Z %s >> %s 2>> %s", bkpinfo->zip_exe, tarball_fname, outlog, outlog); 468 468 } 469 469 log_msg(6, "command=%s", command); … … 472 472 473 473 if (length_of_file(outlog) < 10) { 474 mr_asprintf( &command, "cat %s >> %s", outlog, MONDO_LOGFILE);474 mr_asprintf(command, "cat %s >> %s", outlog, MONDO_LOGFILE); 475 475 } else { 476 mr_asprintf( &command, "cut -d: -f%d %s | sort -u", (bkpinfo->use_star) ? 1 : 2, outlog);476 mr_asprintf(command, "cut -d: -f%d %s | sort -u", (bkpinfo->use_star) ? 1 : 2, outlog); 477 477 pin = popen(command, "r"); 478 478 if (pin) { … … 580 580 p++; 581 581 } 582 mr_asprintf( &tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);582 mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); 583 583 paranoid_system(tmp); 584 584 mr_free(tmp); 585 585 586 mr_asprintf( &tarball_fname, "%s/tmpfs/temporary-%s", bkpinfo->tmpdir, p);586 mr_asprintf(tarball_fname, "%s/tmpfs/temporary-%s", bkpinfo->tmpdir, p); 587 587 read_file_from_stream_to_file(tarball_fname, size); 588 588 res = verify_a_tarball(tarball_fname); … … 639 639 p++; 640 640 } 641 mr_asprintf( &test_file, "%s/temporary-%s", bkpinfo->tmpdir, p);641 mr_asprintf(test_file, "%s/temporary-%s", bkpinfo->tmpdir, p); 642 642 for (res = 643 643 read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr); … … 666 666 if (strcmp(biggie_cksum, orig_cksum)) { 667 667 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);668 mr_asprintf(tmp, "%s has changed on live filesystem", biggie_fname); 669 669 log_to_screen(tmp); 670 670 mr_free(tmp); 671 671 672 mr_asprintf( &tmp, "echo \"%s\" >> %s/biggies.changed", biggie_fname, bkpinfo->tmpdir);672 mr_asprintf(tmp, "echo \"%s\" >> %s/biggies.changed", biggie_fname, bkpinfo->tmpdir); 673 673 system(tmp); 674 674 mr_free(tmp); … … 713 713 714 714 if (g_getfattr) { 715 mr_asprintf( &curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);715 mr_asprintf(curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 716 716 } 717 717 if (g_getfacl) { 718 mr_asprintf( &curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);718 mr_asprintf(curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 719 719 } 720 720 log_to_screen("Verifying regular archives on tape"); … … 749 749 res = read_header_block_from_stream(&size, fname, &ctrl_chr)) { 750 750 if (g_getfattr) { 751 mr_asprintf( &curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, current_afioball_number);751 mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, current_afioball_number); 752 752 } 753 753 if (g_getfacl) { 754 mr_asprintf( &curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, current_afioball_number);754 mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, current_afioball_number); 755 755 } 756 756 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { … … 770 770 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 771 771 } 772 mr_asprintf( &tmp, "Verifying fileset #%ld", current_afioball_number);772 mr_asprintf(tmp, "Verifying fileset #%ld", current_afioball_number); 773 773 update_progress_form(tmp); 774 774 mr_free(tmp); … … 776 776 res = verify_an_afioball_from_stream(fname, size); 777 777 if (res) { 778 mr_asprintf( &tmp, "Afioball %ld differs from live filesystem", current_afioball_number);778 mr_asprintf(tmp, "Afioball %ld differs from live filesystem", current_afioball_number); 779 779 log_to_screen(tmp); 780 780 mr_free(tmp); … … 830 830 831 831 if (g_getfattr) { 832 mr_asprintf( &curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);832 mr_asprintf(curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 833 833 } 834 834 if (g_getfacl) { 835 mr_asprintf( &curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);836 } 837 mr_asprintf( &comment, "Verifying all bigfiles.");835 mr_asprintf(curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 836 } 837 mr_asprintf(comment, "Verifying all bigfiles."); 838 838 log_to_screen(comment); 839 839 res = read_header_block_from_stream(&size, orig_fname, &ctrl_chr); … … 878 878 p++; 879 879 } 880 mr_asprintf( &comment, "Verifying bigfile #%ld (%ld K)", current_biggiefile_number, (long) size >> 10);880 mr_asprintf(comment, "Verifying bigfile #%ld (%ld K)", current_biggiefile_number, (long) size >> 10); 881 881 update_progress_form(comment); 882 882 mr_free(comment); 883 883 884 mr_asprintf( &logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname);884 mr_asprintf(logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname); 885 885 res = verify_a_biggiefile_from_stream(logical_fname, size); 886 886 mr_free(logical_fname); … … 901 901 * Verify the USB device 902 902 * @param bkpinfo The backup information structure. Fields used: 903 * - @c bkpinfo->isodir904 903 * - @c bkpinfo->media_device 905 904 * - @c bkpinfo->tmpdir … … 931 930 assert(bkpinfo != NULL); 932 931 933 mr_asprintf( &fname, "%s1", bkpinfo->media_device);932 mr_asprintf(fname, "%s1", bkpinfo->media_device); 934 933 if (is_this_device_mounted(fname)) { 935 934 log_msg(1, "USB device mounted. Remounting it at the right place"); 936 mr_asprintf( &tmp, "umount %s", fname);935 mr_asprintf(tmp, "umount %s", fname); 937 936 run_program_and_log_output(tmp, FALSE); 938 937 paranoid_free(tmp); … … 941 940 942 941 log_msg(1, "Mounting USB device."); 943 mr_asprintf( &mountpoint, "%s/usb", bkpinfo->tmpdir);944 mr_asprintf( &tmp, "mkdir -p %s", mountpoint);942 mr_asprintf(mountpoint, "%s/usb", bkpinfo->tmpdir); 943 mr_asprintf(tmp, "mkdir -p %s", mountpoint); 945 944 run_program_and_log_output(tmp, FALSE); 946 945 paranoid_free(tmp); 947 946 /* Mindi always create one single parition on the USB dev */ 948 mr_asprintf( &tmp, "mount %s1 %s", bkpinfo->media_device, mountpoint);947 mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, mountpoint); 949 948 ret = run_program_and_log_output(tmp, FALSE); 950 949 paranoid_free(tmp); … … 956 955 sync(); 957 956 log_msg(2, "OK, I've mounted the USB Disk/Key\n"); 958 mr_asprintf( &tmp, "%s/archives/NOT-THE-LAST", mountpoint);957 mr_asprintf(tmp, "%s/archives/NOT-THE-LAST", mountpoint); 959 958 if (!does_file_exist(tmp)) { 960 959 log_msg … … 973 972 verify_all_slices_on_CD(mountpoint); 974 973 975 mr_asprintf( &tmp1, "umount %s", mountpoint);974 mr_asprintf(tmp1, "umount %s", mountpoint); 976 975 #ifdef __FreeBSD__ 977 976 ret += system(tmp1); … … 982 981 #endif 983 982 { 984 mr_asprintf( &tmp, "%s failed; unable to unmount USB device\n", tmp1);983 mr_asprintf(tmp, "%s failed; unable to unmount USB device\n", tmp1); 985 984 log_to_screen(tmp); 986 985 paranoid_free(tmp); … … 1031 1030 assert(bkpinfo != NULL); 1032 1031 1033 mr_asprintf( &mountpoint, "%s/cdrom", bkpinfo->tmpdir);1034 mr_asprintf( &fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);1032 mr_asprintf(mountpoint, "%s/cdrom", bkpinfo->tmpdir); 1033 mr_asprintf(fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number); 1035 1034 1036 1035 mkdir(mountpoint, 1777); … … 1054 1053 mddevice = make_vn(fname); 1055 1054 if (ret) { 1056 mr_asprintf( &tmp, "make_vn of %s failed; unable to verify ISO\n", fname);1055 mr_asprintf(tmp, "make_vn of %s failed; unable to verify ISO\n", fname); 1057 1056 log_to_screen(tmp); 1058 1057 mr_free(tmp); … … 1061 1060 return (1); 1062 1061 } 1063 mr_asprintf( &command, "mount_cd9660 %s %s", mddevice, mountpoint);1062 mr_asprintf(command, "mount_cd9660 %s %s", mddevice, mountpoint); 1064 1063 #else 1065 mr_asprintf( &command, "mount -o loop,ro -t iso9660 %s %s", fname, mountpoint);1064 mr_asprintf(command, "mount -o loop,ro -t iso9660 %s %s", fname, mountpoint); 1066 1065 #endif 1067 1066 if (run_program_and_log_output(command, FALSE)) { 1068 mr_asprintf( &tmp, "%s failed; unable to mount ISO image\n", command);1067 mr_asprintf(tmp, "%s failed; unable to mount ISO image\n", command); 1069 1068 log_to_screen(tmp); 1070 1069 mr_free(tmp); … … 1077 1076 } 1078 1077 log_msg(2, "OK, I've mounted the ISO/CD\n"); 1079 mr_asprintf( &tmp, "%s/archives/NOT-THE-LAST", mountpoint);1078 mr_asprintf(tmp, "%s/archives/NOT-THE-LAST", mountpoint); 1080 1079 if (!does_file_exist(tmp)) { 1081 1080 log_msg … … 1097 1096 #ifdef __FreeBSD__ 1098 1097 ret = 0; 1099 mr_asprintf( &command, "umount %s", mountpoint);1098 mr_asprintf(command, "umount %s", mountpoint); 1100 1099 ret += system(command); 1101 1100 ret += kick_vn(mddevice); 1102 1101 if (ret) 1103 1102 #else 1104 mr_asprintf( &command, "umount %s", mountpoint);1103 mr_asprintf(command, "umount %s", mountpoint); 1105 1104 if (system(command)) 1106 1105 #endif 1107 1106 { 1108 mr_asprintf( &tmp, "%s failed; unable to unmount ISO image\n", command);1107 mr_asprintf(tmp, "%s failed; unable to unmount ISO image\n", command); 1109 1108 log_to_screen(tmp); 1110 1109 mr_free(tmp); … … 1118 1117 1119 1118 if (!does_file_exist(fname)) { 1120 mr_asprintf( &command, "umount %s", bkpinfo->media_device);1119 mr_asprintf(command, "umount %s", bkpinfo->media_device); 1121 1120 run_program_and_log_output(command, 2); 1122 1121 mr_free(command); … … 1165 1164 /* close tape; exit */ 1166 1165 // fclose(g_tape_stream); <-- not needed; is handled by closein_tape() 1167 mr_asprintf( &tmp, "rm -f %s/biggies.changed %s/changed.files 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);1166 mr_asprintf(tmp, "rm -f %s/biggies.changed %s/changed.files 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir); 1168 1167 paranoid_system(tmp); 1169 1168 mr_free(tmp); 1170 1169 1171 mr_asprintf( &changed_files_fname, "%s/changed.files", bkpinfo->tmpdir);1172 mr_asprintf( &tmp, "grep -E '^%s:.*$' %s | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vE '^/afio:.*$' | grep -vE '^dev/.*$' > %s", (bkpinfo->use_star) ? "star" : "afio", MONDO_LOGFILE, changed_files_fname);1170 mr_asprintf(changed_files_fname, "%s/changed.files", bkpinfo->tmpdir); 1171 mr_asprintf(tmp, "grep -E '^%s:.*$' %s | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vE '^/afio:.*$' | grep -vE '^dev/.*$' > %s", (bkpinfo->use_star) ? "star" : "afio", MONDO_LOGFILE, changed_files_fname); 1173 1172 log_msg(2, "Running command to derive list of changed files"); 1174 1173 log_msg(2, tmp); … … 1182 1181 mr_free(tmp); 1183 1182 1184 mr_asprintf( &tmp, "cat %s/biggies.changed >> %s", bkpinfo->tmpdir, changed_files_fname);1183 mr_asprintf(tmp, "cat %s/biggies.changed >> %s", bkpinfo->tmpdir, changed_files_fname); 1185 1184 paranoid_system(tmp); 1186 1185 mr_free(tmp); … … 1188 1187 diffs = count_lines_in_file(changed_files_fname); 1189 1188 if (diffs > 0) { 1190 mr_asprintf( &tmp, "cp -f %s %s/changed.files", changed_files_fname, MONDO_CACHE);1189 mr_asprintf(tmp, "cp -f %s %s/changed.files", changed_files_fname, MONDO_CACHE); 1191 1190 run_program_and_log_output(tmp, FALSE); 1192 1191 mr_free(tmp); -
branches/2.2.10/mondo/src/common/mondostructures.h
r2322 r2323 421 421 422 422 /** 423 * A filename containing a list of extensions, one per line, to not424 * compress. If this is set to "", afio will still exclude a set of well-known425 * compressed files from compression, but biggiefiles that are compressed426 * will be recompressed again.427 */428 char do_not_compress_these[MAX_STR_LEN / 2];429 430 /**431 423 * If TRUE, then we should verify a backup. 432 424 */ … … 465 457 * If backup_media_type is anything else, this is ignored. 466 458 */ 467 char isodir[MAX_STR_LEN / 4];459 char *isodir; 468 460 469 461 /** -
branches/2.2.10/mondo/src/common/newt-specific.c
r2321 r2323 276 276 char *tmp1 = NULL; 277 277 278 mr_asprintf( &tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str , ps_proc_id);278 mr_asprintf(tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str , ps_proc_id); 279 279 run_program_and_log_output(tmp, TRUE); 280 280 if (strlen(tmp) > 0) { 281 mr_asprintf( &tmp1,"kill `%s`", tmp);281 mr_asprintf(tmp1,"kill `%s`", tmp); 282 282 run_program_and_log_output(tmp1, TRUE); 283 283 mr_free(tmp1); … … 334 334 chdir("/"); 335 335 if (g_selfmounted_isodir) { 336 mr_asprintf( &command, "umount %s", g_selfmounted_isodir);336 mr_asprintf(command, "umount %s", g_selfmounted_isodir); 337 337 run_program_and_log_output(command, 5); 338 338 mr_free(command); 339 mr_asprintf( &command, "rmdir %s", g_selfmounted_isodir);339 mr_asprintf(command, "rmdir %s", g_selfmounted_isodir); 340 340 run_program_and_log_output(command, 5); 341 341 mr_free(command); … … 386 386 run_program_and_log_output("umount " MNT_CDROM, FALSE); 387 387 if (g_selfmounted_isodir) { 388 mr_asprintf( &command, "umount %s", g_selfmounted_isodir);388 mr_asprintf(command, "umount %s", g_selfmounted_isodir); 389 389 run_program_and_log_output(command, 1); 390 390 mr_free(command); 391 391 392 mr_asprintf( &command, "rmdir %s", g_selfmounted_isodir);392 mr_asprintf(command, "rmdir %s", g_selfmounted_isodir); 393 393 run_program_and_log_output(command, 1); 394 394 mr_free(command); … … 409 409 if (strstr(bkpinfo->tmpdir ,"mondo.tmp.") != NULL) { 410 410 log_msg(8,"erasing tempdir"); 411 mr_asprintf( &command, "rm -Rf %s", bkpinfo->tmpdir);411 mr_asprintf(command, "rm -Rf %s", bkpinfo->tmpdir); 412 412 system(command); 413 413 mr_free(command); … … 418 418 if (strstr(bkpinfo->scratchdir ,"mondo.scratch.") != NULL) { 419 419 log_msg(8,"erasing scratchdir"); 420 mr_asprintf( &command, "rm -Rf %s", bkpinfo->scratchdir);420 mr_asprintf(command, "rm -Rf %s", bkpinfo->scratchdir); 421 421 system(command); 422 422 mr_free(command); … … 754 754 /* take default if ENTER was typed */ 755 755 mr_free(output); 756 mr_asprintf( &output, "%s", input);756 mr_asprintf(output, "%s", input); 757 757 } 758 758 if (output[strlen(output) - 1] == '\n') … … 761 761 } 762 762 763 mr_asprintf( &blurb, "%s", b);763 mr_asprintf(blurb, "%s", b); 764 764 text = newtTextboxReflowed(2, 1, blurb, 48, 5, 5, 0); 765 765 type_here = … … 782 782 783 783 if (b_res == b_1) { 784 mr_asprintf( &output, "%s", newtEntryGetValue(type_here));784 mr_asprintf(output, "%s", newtEntryGetValue(type_here)); 785 785 } 786 786 newtPopHelpLine(); … … 982 982 || percentage > g_isoform_old_progress) { 983 983 g_isoform_old_progress = percentage; 984 mr_asprintf( &timeline_str, "%2ld:%02ld taken %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);984 mr_asprintf(timeline_str, "%2ld:%02ld taken %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60); 985 985 if (percentage < 3) { 986 mr_asprintf( &pcline_str, " Working");986 mr_asprintf(pcline_str, " Working"); 987 987 for (j = 0; j < g_mysterious_dot_counter; j++) { 988 988 mr_strcat(pcline_str, "."); … … 993 993 mr_strcat(pcline_str, " %c", special_dot_char(g_mysterious_dot_counter)); 994 994 } else { 995 mr_asprintf( &pcline_str, " %3d%% done %3d%% to go", percentage, 100 - percentage);995 mr_asprintf(pcline_str, " %3d%% done %3d%% to go", percentage, 100 - percentage); 996 996 } 997 997 if (g_text_mode) { 998 mr_asprintf( &taskprogress, "TASK: [");998 mr_asprintf(taskprogress, "TASK: ["); 999 999 for (i = 0; i < percentage; i += 5) { 1000 1000 mr_strcat(taskprogress, "*"); … … 1117 1117 printf("---progress-form---3--- %s\n", blurb3); 1118 1118 printf("---progress-form---E---\n"); 1119 mr_asprintf( &taskprogress, "TASK: [");1119 mr_asprintf(taskprogress, "TASK: ["); 1120 1120 for (i = 0; i < percentage; i += 5) { 1121 1121 mr_strcat(taskprogress, "*"); … … 1131 1131 paranoid_free(taskprogress); 1132 1132 } else { 1133 mr_asprintf( &timeline_str, "%2ld:%02ld taken %2ld:%02ld remaining ", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);1134 mr_asprintf( &percentline_str, " %3d%% done %3d%% to go", percentage, 100 - percentage);1133 mr_asprintf(timeline_str, "%2ld:%02ld taken %2ld:%02ld remaining ", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60); 1134 mr_asprintf(percentline_str, " %3d%% done %3d%% to go", percentage, 100 - percentage); 1135 1135 1136 1136 center_string(blurb1, 54); … … 1359 1359 } 1360 1360 1361 mr_asprintf( &tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir);1361 mr_asprintf(tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir); 1362 1362 if (!(fout = fopen(tmp1, "a"))) { 1363 1363 log_msg(2, "Can't write to %s", tmp1); … … 1453 1453 assert(flentry != NULL); 1454 1454 if (flentry->severity == 0) { 1455 mr_asprintf( &tmp, "0 ");1455 mr_asprintf(tmp, "0 "); 1456 1456 } else if (flentry->severity == 1) { 1457 mr_asprintf( &tmp, "low ");1457 mr_asprintf(tmp, "low "); 1458 1458 } else if (flentry->severity == 2) { 1459 mr_asprintf( &tmp, "med ");1460 } else { 1461 mr_asprintf( &tmp, "high");1459 mr_asprintf(tmp, "med "); 1460 } else { 1461 mr_asprintf(tmp, "high"); 1462 1462 } 1463 1463 mr_strcat(tmp, " "); … … 1540 1540 keylist[i]); 1541 1541 } 1542 mr_asprintf( &differ_sz, " %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", i);1542 mr_asprintf(differ_sz, " %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", i); 1543 1543 newtPushHelpLine(differ_sz); 1544 1544 mr_free(differ_sz); … … 1546 1546 bClose = newtCompactButton(10, 15, " Close "); 1547 1547 bSelect = newtCompactButton(30, 15, " Select "); 1548 mr_asprintf( &tmp, "%-10s %-20s", "Priority", "Filename");1548 mr_asprintf(tmp, "%-10s %-20s", "Priority", "Filename"); 1549 1549 headerMsg = newtLabel(2, 1, tmp); 1550 1550 mr_free(tmp); … … 1571 1571 if (filelist->entries > 0) { 1572 1572 severity_of_difference(filelist->el[currline]. filename, reason); 1573 mr_asprintf( &tmp, "%s --- %s", filelist->el[currline].filename, reason);1573 mr_asprintf(tmp, "%s --- %s", filelist->el[currline].filename, reason); 1574 1574 1575 1575 popup_and_OK(tmp); -
branches/2.2.10/mondo/src/include/mr_mem.h
r2320 r2323 19 19 #define mr_free(x) mr_free_int((void **)&x,__LINE__,__FILE__) 20 20 #define mr_allocstr(x,y) mr_allocstr_int(x,y,__LINE__,__FILE__) 21 #define mr_asprintf(x,y,args...) mr_asprintf_int( x,__LINE__,__FILE__,y,## args)21 #define mr_asprintf(x,y,args...) mr_asprintf_int((char **)&x,__LINE__,__FILE__,y,## args) 22 22 #define mr_getline(x,y) mr_getline_int(x,y,__LINE__,__FILE__) 23 23 #define mr_malloc(x) mr_malloc_int((size_t)x,__LINE__,__FILE__) -
branches/2.2.10/mondo/src/lib/mr_conf.c
r2291 r2323 108 108 CONF = fopen(filename, "r"); 109 109 110 mr_asprintf( &mr_conf_filename, "%s", filename);110 mr_asprintf(mr_conf_filename, "%s", filename); 111 111 112 112 /*if file is empty or not exist => error */ … … 198 198 p = mr_conf_read(field_name); 199 199 if (p != NULL) { 200 mr_asprintf( &p1, "%d", p);200 mr_asprintf(p1, "%d", p); 201 201 } 202 202 return p1; … … 210 210 p = mr_conf_read(field_name); 211 211 if (p != NULL) { 212 mr_asprintf( &p1, "%f", p);212 mr_asprintf(p1, "%f", p); 213 213 } 214 214 return p1; … … 232 232 return(p); 233 233 } 234 mr_asprintf( &q, "%s", p);234 mr_asprintf(q, "%s", p); 235 235 236 236 if (*p != '"') { … … 275 275 (strncasecmp(p, "t" , (size_t)1) == 0) || 276 276 (strncasecmp(p, "1" , (size_t)1) == 0)) { 277 mr_asprintf( &p1, "%d", TRUE);277 mr_asprintf(p1, "%d", TRUE); 278 278 } else { 279 mr_asprintf( &p1, "%d", FALSE);279 mr_asprintf(p1, "%d", FALSE); 280 280 } 281 281 } … … 288 288 char *p = NULL; 289 289 290 mr_asprintf( &p, "%d", FALSE);290 mr_asprintf(p, "%d", FALSE); 291 291 if (strcmp(str,p) != 0) { 292 292 ret = TRUE; -
branches/2.2.10/mondo/src/mondoarchive/mondoarchive.c
r2322 r2323 209 209 210 210 /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */ 211 mr_asprintf( &tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH"));211 mr_asprintf(tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH")); 212 212 setenv("PATH", tmp1, 1); 213 213 mr_free(tmp1); 214 214 215 215 /* Add the ARCH environment variable for ia64 purposes */ 216 mr_asprintf( &tmp1,"%s",get_architecture());216 mr_asprintf(tmp1,"%s",get_architecture()); 217 217 setenv("ARCH", tmp1, 1); 218 218 mr_free(tmp1); … … 352 352 retval += res; 353 353 if (res) { 354 mr_asprintf( &say_at_end, "Data archived. Please check the logs, just as a precaution. ");355 } else { 356 mr_asprintf( &say_at_end, "Data archived OK. ");354 mr_asprintf(say_at_end, "Data archived. Please check the logs, just as a precaution. "); 355 } else { 356 mr_asprintf(say_at_end, "Data archived OK. "); 357 357 } 358 358 } … … 362 362 res = verify_data(); 363 363 if (res < 0) { 364 mr_asprintf( &tmp, "%d difference%c found.", -res,364 mr_asprintf(tmp, "%d difference%c found.", -res, 365 365 (-res != 1) ? 's' : ' '); 366 mr_asprintf( &say_at_end, "%s", tmp);366 mr_asprintf(say_at_end, "%s", tmp); 367 367 log_to_screen(tmp); 368 368 mr_free(tmp); … … 402 402 mr_free(say_at_end); 403 403 } 404 mr_asprintf( &tmp, "umount %s/tmpfs", bkpinfo->tmpdir);404 mr_asprintf(tmp, "umount %s/tmpfs", bkpinfo->tmpdir); 405 405 run_program_and_log_output(tmp, TRUE); 406 406 mr_free(tmp); 407 407 if (bkpinfo->backup_media_type == usb) { 408 408 log_msg(1, "Unmounting USB device."); 409 mr_asprintf( &tmp, "umount %s1", bkpinfo->media_device);409 mr_asprintf(tmp, "umount %s1", bkpinfo->media_device); 410 410 run_program_and_log_output(tmp, TRUE); 411 411 mr_free(tmp); -
branches/2.2.10/mondo/src/mondorestore/mondo-prep.c
r2316 r2323 79 79 make_list_of_drives_in_mountlist(mountlist, drivelist); 80 80 for (lino = 0; lino < drivelist->entries; lino++) { 81 mr_asprintf( &command, "dd if=%s bs=512 count=1 2> /dev/null | grep \"%s\"", drivelist->el[lino].device, MONDO_WAS_HERE);81 mr_asprintf(command, "dd if=%s bs=512 count=1 2> /dev/null | grep \"%s\"", drivelist->el[lino].device, MONDO_WAS_HERE); 82 82 res = run_program_and_log_output(command, 1); 83 83 mr_free(command); … … 258 258 strcpy(vgremove_sz, "vgremove"); 259 259 } 260 mr_asprintf( &tmp1, "for i in `%s | cut -d\"'\" -f2 | sort -r` ; do echo \"Shutting down lv $i\" >> %s ; %s -f $i; done", lvscan_sz, MONDO_LOGFILE, lvremove_sz);260 mr_asprintf(tmp1, "for i in `%s | cut -d\"'\" -f2 | sort -r` ; do echo \"Shutting down lv $i\" >> %s ; %s -f $i; done", lvscan_sz, MONDO_LOGFILE, lvremove_sz); 261 261 run_program_and_log_output(tmp1, 5); 262 262 mr_free(tmp1); … … 305 305 *q = '\0'; 306 306 log_msg(1, "Deleting old entries at /dev/%s", tmp); 307 mr_asprintf( &tmp1, "rm -Rf /dev/%s", tmp);307 mr_asprintf(tmp1, "rm -Rf /dev/%s", tmp); 308 308 run_program_and_log_output(tmp1, 1); 309 309 mr_free(tmp1); … … 335 335 log_it("%s... so I'll get creative.", tmp); 336 336 if (lvmversion == 2) { 337 mr_asprintf( &tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE);337 mr_asprintf(tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE); 338 338 strcpy(tmp, call_program_and_get_last_line_of_output(tmp1)); 339 339 mr_free(tmp1); 340 340 } else { 341 mr_asprintf( &tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE);341 mr_asprintf(tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE); 342 342 strcpy(tmp, call_program_and_get_last_line_of_output(tmp1)); 343 343 mr_free(tmp1); … … 393 393 retval++; 394 394 } 395 mr_asprintf( &tmp1, "echo \"%s\" >> /tmp/out.sh", command);395 mr_asprintf(tmp1, "echo \"%s\" >> /tmp/out.sh", command); 396 396 system(tmp1); 397 397 mr_free(tmp1); … … 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);486 mr_asprintf(tmp, "Investigating %s", old_mountlist->el[lino].device); 487 487 log_it(tmp); 488 488 mr_free(tmp); … … 497 497 *p = '\0'; 498 498 for (p--; p > incoming && *(p - 1) > 32; p--); 499 mr_asprintf( &tmp, "Extrapolating %s", p);499 mr_asprintf(tmp, "Extrapolating %s", p); 500 500 log_it(tmp); 501 501 mr_free(tmp); … … 518 518 new_mountlist->entries++; 519 519 } else { 520 mr_asprintf( &tmp, "Not adding %s to mountlist: it's already there", p);520 mr_asprintf(tmp, "Not adding %s to mountlist: it's already there", p); 521 521 log_it(tmp); 522 522 mr_free(tmp); … … 582 582 } 583 583 // create device list from normal disks followed by spare ones 584 mr_asprintf( &devices, "%s", raidlist->el[i].data_disks.el[0].device);584 mr_asprintf(devices, "%s", raidlist->el[i].data_disks.el[0].device); 585 585 for (j = 1; j < raidlist->el[i].data_disks.entries; j++) { 586 mr_asprintf( &strtmp, "%s", devices);586 mr_asprintf(strtmp, "%s", devices); 587 587 paranoid_free(devices); 588 mr_asprintf( &devices, "%s %s", strtmp,588 mr_asprintf(devices, "%s %s", strtmp, 589 589 raidlist->el[i].data_disks.el[j].device); 590 590 paranoid_free(strtmp); 591 591 } 592 592 for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) { 593 mr_asprintf( &strtmp, "%s", devices);593 mr_asprintf(strtmp, "%s", devices); 594 594 paranoid_free(devices); 595 mr_asprintf( &devices, "%s %s", strtmp,595 mr_asprintf(devices, "%s %s", strtmp, 596 596 raidlist->el[i].spare_disks.el[j].device); 597 597 paranoid_free(strtmp); … … 599 599 // translate RAID level 600 600 if (raidlist->el[i].raid_level == -2) { 601 mr_asprintf( &level, "multipath");601 mr_asprintf(level, "multipath"); 602 602 } else if (raidlist->el[i].raid_level == -1) { 603 mr_asprintf( &level, "linear");603 mr_asprintf(level, "linear"); 604 604 } else { 605 mr_asprintf( &level, "raid%d", raidlist->el[i].raid_level);605 mr_asprintf(level, "raid%d", raidlist->el[i].raid_level); 606 606 } 607 607 // create RAID device: … … 610 610 // - faulty devices ignored 611 611 // - persistent superblock always used as this is recommended 612 mr_asprintf( &program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries);612 mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries); 613 613 if (raidlist->el[i].parity != -1) { 614 mr_asprintf( &strtmp, "%s", program);614 mr_asprintf(strtmp, "%s", program); 615 615 paranoid_free(program); 616 616 switch(raidlist->el[i].parity) { 617 617 case 0: 618 mr_asprintf( &program, "%s --parity=%s", strtmp, "la");618 mr_asprintf(program, "%s --parity=%s", strtmp, "la"); 619 619 break; 620 620 case 1: 621 mr_asprintf( &program, "%s --parity=%s", strtmp, "ra");621 mr_asprintf(program, "%s --parity=%s", strtmp, "ra"); 622 622 break; 623 623 case 2: 624 mr_asprintf( &program, "%s --parity=%s", strtmp, "ls");624 mr_asprintf(program, "%s --parity=%s", strtmp, "ls"); 625 625 break; 626 626 case 3: 627 mr_asprintf( &program, "%s --parity=%s", strtmp, "rs");627 mr_asprintf(program, "%s --parity=%s", strtmp, "rs"); 628 628 break; 629 629 default: … … 634 634 } 635 635 if (raidlist->el[i].chunk_size != -1) { 636 mr_asprintf( &strtmp, "%s", program);636 mr_asprintf(strtmp, "%s", program); 637 637 paranoid_free(program); 638 mr_asprintf( &program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size);638 mr_asprintf(program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size); 639 639 paranoid_free(strtmp); 640 640 } 641 641 if (raidlist->el[i].spare_disks.entries > 0) { 642 mr_asprintf( &strtmp, "%s", program);642 mr_asprintf(strtmp, "%s", program); 643 643 paranoid_free(program); 644 mr_asprintf( &program, "%s --spare-devices=%d", strtmp, raidlist->el[i].spare_disks.entries);644 mr_asprintf(program, "%s --spare-devices=%d", strtmp, raidlist->el[i].spare_disks.entries); 645 645 paranoid_free(strtmp); 646 646 } 647 mr_asprintf( &strtmp, "%s", program);647 mr_asprintf(strtmp, "%s", program); 648 648 paranoid_free(program); 649 mr_asprintf( &program, "%s %s", strtmp, devices);649 mr_asprintf(program, "%s %s", strtmp, devices); 650 650 paranoid_free(strtmp); 651 651 res = run_program_and_log_output(program, 1); … … 688 688 689 689 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);690 mr_asprintf(tmp, "Not formatting %s (it is a RAID disk)", device); 691 691 log_it(tmp); 692 692 mr_free(tmp); … … 700 700 #endif 701 701 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);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 703 log_it(tmp); 704 704 mr_free(tmp); … … 706 706 } 707 707 if (is_this_device_mounted(device)) { 708 mr_asprintf( &tmp, "%s is mounted - cannot format it ", device);708 mr_asprintf(tmp, "%s is mounted - cannot format it ", device); 709 709 log_to_screen(tmp); 710 710 mr_free(tmp); … … 736 736 char line[MAX_STR_LEN]; 737 737 738 mr_asprintf( &tmp, "Initializing Vinum device %s (this may take a *long* time)", device);738 mr_asprintf(tmp, "Initializing Vinum device %s (this may take a *long* time)", device); 739 739 log_to_screen(tmp); 740 740 mr_free(tmp); 741 741 742 742 /* format raid partition */ 743 mr_asprintf( &program, "for plex in `vinum lv -r %s | grep '^P' | tr '\t' ' ' | tr -s ' ' | cut -d' ' -f2`; do echo $plex; done > /tmp/plexes", basename(device));743 mr_asprintf(program, "for plex in `vinum lv -r %s | grep '^P' | tr '\t' ' ' | tr -s ' ' | cut -d' ' -f2`; do echo $plex; done > /tmp/plexes", basename(device)); 744 744 system(program); 745 745 if (g_fprep) { … … 753 753 *(strchr(line, '\n')) = '\0'; // get rid of the \n on the end 754 754 755 mr_asprintf( &tmp, "Initializing plex: %s", line);755 mr_asprintf(tmp, "Initializing plex: %s", line); 756 756 open_evalcall_form(tmp); 757 757 mr_free(tmp); 758 758 759 mr_asprintf( &tmp, "vinum init %s", line);759 mr_asprintf(tmp, "vinum init %s", line); 760 760 system(tmp); 761 761 mr_free(tmp); 762 762 763 763 while (1) { 764 mr_asprintf( &tmp, "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", line);764 mr_asprintf(tmp, "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", line); 765 765 FILE *pin = popen(tmp, "r"); 766 766 mr_free(tmp); … … 782 782 } 783 783 #else 784 mr_asprintf( &tmp, "Initializing RAID device %s", device);784 mr_asprintf(tmp, "Initializing RAID device %s", device); 785 785 log_to_screen(tmp); 786 786 mr_free(tmp); … … 798 798 log_msg(1, "Creating RAID device %s via mdadm returned %d", device, res); 799 799 } else { 800 mr_asprintf( &program, "mkraid --really-force %s", device);800 mr_asprintf(program, "mkraid --really-force %s", device); 801 801 res = run_program_and_log_output(program, 1); 802 802 log_msg(1, "%s returned %d", program, res); … … 822 822 } 823 823 program = which_format_command_do_i_need(format); 824 mr_asprintf( &tmp, "%s %s", program, device);824 mr_asprintf(tmp, "%s %s", program, device); 825 825 if (strstr(program, "kludge")) { 826 826 mr_strcat(tmp, " /"); … … 828 828 mr_free(program); 829 829 830 mr_asprintf( &program, "sh -c 'echo -en \"y\\ny\\ny\\n\" | %s'", tmp);830 mr_asprintf(program, "sh -c 'echo -en \"y\\ny\\ny\\n\" | %s'", tmp); 831 831 mr_free(tmp); 832 832 833 mr_asprintf( &tmp, "Formatting %s as %s", device, format);833 mr_asprintf(tmp, "Formatting %s as %s", device, format); 834 834 update_progress_form(tmp); 835 835 mr_free(tmp); … … 848 848 mr_free(program); 849 849 #ifdef __FreeBSD__ 850 mr_asprintf( &program, "newfs_msdos -F 32 %s", device);850 mr_asprintf(program, "newfs_msdos -F 32 %s", device); 851 851 #else 852 852 #ifdef __IA64__ 853 853 /* For EFI partitions take fat16 854 854 * as we want to make small ones */ 855 mr_asprintf( &program, "mkfs -t %s -F 16 %s", format, device);855 mr_asprintf(program, "mkfs -t %s -F 16 %s", format, device); 856 856 #else 857 mr_asprintf( &program, "mkfs -t %s -F 32 %s", format, device);857 mr_asprintf(program, "mkfs -t %s -F 32 %s", format, device); 858 858 #endif 859 859 #endif … … 911 911 912 912 assert(mountlist != NULL); 913 mr_asprintf( &tmp, "format_everything (mountlist, interactively = %s", (interactively) ? "true" : "false");913 mr_asprintf(tmp, "format_everything (mountlist, interactively = %s", (interactively) ? "true" : "false"); 914 914 log_it(tmp); 915 915 mr_free(tmp); … … 939 939 if (interactively) { 940 940 // ask user if we should format the current device 941 mr_asprintf( &tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint);941 mr_asprintf(tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint); 942 942 do_it = ask_me_yes_or_no(tmp); 943 943 mr_free(tmp); … … 989 989 me = &mountlist->el[lino]; // the current mountlist entry 990 990 if (!strcmp(me->mountpoint, "image")) { 991 mr_asprintf( &tmp, "Not formatting %s - it's an image", me->device);991 mr_asprintf(tmp, "Not formatting %s - it's an image", me->device); 992 992 log_it(tmp); 993 993 mr_free(tmp); 994 994 } else if (!strcmp(me->format, "raid")) { 995 mr_asprintf( &tmp, "Not formatting %s - it's a raid-let", me->device);995 mr_asprintf(tmp, "Not formatting %s - it's a raid-let", me->device); 996 996 log_it(tmp); 997 997 mr_free(tmp); 998 998 continue; 999 999 } else if (!strcmp(me->format, "lvm")) { 1000 mr_asprintf( &tmp, "Not formatting %s - it's an LVM", me->device);1000 mr_asprintf(tmp, "Not formatting %s - it's an LVM", me->device); 1001 1001 log_it(tmp); 1002 1002 mr_free(tmp); 1003 1003 continue; 1004 1004 } else if (!strncmp(me->device, "/dev/md", 7)) { 1005 mr_asprintf( &tmp, "Already formatted %s - it's a soft-RAID dev", me->device);1005 mr_asprintf(tmp, "Already formatted %s - it's a soft-RAID dev", me->device); 1006 1006 log_it(tmp); 1007 1007 mr_free(tmp); … … 1010 1010 && strncmp(me->device, "/dev/hd", 7) 1011 1011 && strncmp(me->device, "/dev/sd", 7)) { 1012 mr_asprintf( &tmp, "Not formatting %s yet - doesn't exist - probably an LVM", me->device);1012 mr_asprintf(tmp, "Not formatting %s yet - doesn't exist - probably an LVM", me->device); 1013 1013 log_it(tmp); 1014 1014 mr_free(tmp); … … 1017 1017 if (interactively) { 1018 1018 // ask user if we should format the current device 1019 mr_asprintf( &tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint);1019 mr_asprintf(tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint); 1020 1020 do_it = ask_me_yes_or_no(tmp); 1021 1021 mr_free(tmp); … … 1048 1048 } 1049 1049 1050 mr_asprintf( &tmp, "format_everything () - %s", (retval) ? "failed!" : "finished successfully");1050 mr_asprintf(tmp, "format_everything () - %s", (retval) ? "failed!" : "finished successfully"); 1051 1051 log_it(tmp); 1052 1052 mr_free(tmp); … … 1111 1111 1112 1112 if (devno_we_must_allow_for >= 5) { 1113 mr_asprintf( &tmp, "Making dummy primary 1 on %s", drivename);1113 mr_asprintf(tmp, "Making dummy primary 1 on %s", drivename); 1114 1114 log_it(tmp); 1115 1115 mr_free(tmp); … … 1127 1127 } 1128 1128 for (; current_devno < devno_we_must_allow_for; current_devno++) { 1129 mr_asprintf( &tmp, "Creating dummy partition %d on %s", current_devno, drivename);1129 mr_asprintf(tmp, "Creating dummy partition %d on %s", current_devno, drivename); 1130 1130 log_it(tmp); 1131 1131 mr_free(tmp); … … 1360 1360 for (c = 'a'; c <= 'z'; ++c) { 1361 1361 int idx; 1362 mr_asprintf( &subdev_str, "%s%c", drivename, c);1362 mr_asprintf(subdev_str, "%s%c", drivename, c); 1363 1363 if ((idx = find_device_in_mountlist(mountlist, subdev_str)) < 0) { 1364 1364 lp->d_partitions[c - 'a'].p_size = 0; … … 1416 1416 display_disklabel(ftmp, lp); 1417 1417 fclose(ftmp); 1418 mr_asprintf( &command, "disklabel -wr %s auto", canonical_name(drivename));1418 mr_asprintf(command, "disklabel -wr %s auto", canonical_name(drivename)); 1419 1419 retval += run_program_and_log_output(command, TRUE); 1420 1420 mr_free(command); 1421 1421 1422 mr_asprintf( &command, "disklabel -R %s /tmp/disklabel", canonical_name(drivename));1422 mr_asprintf(command, "disklabel -R %s /tmp/disklabel", canonical_name(drivename)); 1423 1423 retval += run_program_and_log_output(command, TRUE); 1424 1424 mr_free(command); … … 1468 1468 malloc_string(format); 1469 1469 1470 mr_asprintf( &tmp, "Partitioning drive %s", drivename);1470 mr_asprintf(tmp, "Partitioning drive %s", drivename); 1471 1471 log_it(tmp); 1472 1472 mr_free(tmp); … … 1477 1477 #else 1478 1478 make_hole_for_file(FDISK_LOG); 1479 mr_asprintf( &tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);1479 mr_asprintf(tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG); 1480 1480 pout_to_fdisk = popen(tmp, "w"); 1481 1481 mr_free(tmp); … … 1500 1500 // try DangerouslyDedicated mode 1501 1501 for (c = 'a'; c <= 'z'; c++) { 1502 mr_asprintf( &subdev_str, "%s%c", drivename, c);1502 mr_asprintf(subdev_str, "%s%c", drivename, c); 1503 1503 if (find_device_in_mountlist(mountlist, subdev_str) > 0) { 1504 1504 fbsd_part = TRUE; … … 1510 1510 drivename, 1511 1511 0); 1512 mr_asprintf( &command, "disklabel -B %s", basename(drivename));1512 mr_asprintf(command, "disklabel -B %s", basename(drivename)); 1513 1513 if (system(command)) { 1514 1514 log_to_screen … … 1522 1522 } 1523 1523 for (c = 'a'; c <= 'z'; c++) { 1524 mr_asprintf( &subdev_str, "%s%c", device_str, c);1524 mr_asprintf(subdev_str, "%s%c", device_str, c); 1525 1525 if (find_device_in_mountlist(mountlist, subdev_str) > 0) { 1526 1526 fbsd_part = TRUE; … … 1535 1535 partsize = 0; 1536 1536 for (i = 'a'; i < 'z'; ++i) { 1537 mr_asprintf( &subdev_str, "%s%c", device_str, i);1537 mr_asprintf(subdev_str, "%s%c", device_str, i); 1538 1538 line = find_device_in_mountlist(mountlist, subdev_str); 1539 1539 mr_free(subdev_str); … … 1565 1565 file = open(drivename, O_WRONLY); 1566 1566 if (file != -1) { 1567 mr_asprintf( &tmp, "Warning - unable to open %s for wiping it's partition table", drivename);1567 mr_asprintf(tmp, "Warning - unable to open %s for wiping it's partition table", drivename); 1568 1568 log_to_screen(tmp); 1569 1569 mr_free(tmp); … … 1572 1572 for (i = 0; i < 512; i++) { 1573 1573 if (!write(file, "\0", 1)) { 1574 mr_asprintf( &tmp, "Warning - unable to write to %s", drivename);1574 mr_asprintf(tmp, "Warning - unable to write to %s", drivename); 1575 1575 log_to_screen(tmp); 1576 1576 mr_free(tmp); … … 1618 1618 #ifdef __FreeBSD__ 1619 1619 if ((current_devno <= 4) && fbsd_part) { 1620 mr_asprintf( &tmp, "disklabel -B %s", basename(device_str));1620 mr_asprintf(tmp, "disklabel -B %s", basename(device_str)); 1621 1621 retval += label_drive_or_slice(mountlist, device_str, 0); 1622 1622 if (system(tmp)) { … … 1634 1634 if (pout_to_fdisk) { 1635 1635 // mark relevant partition as bootable 1636 mr_asprintf( &tmp, "a\n%s\n", call_program_and_get_last_line_of_output("make-me-bootable /tmp/mountlist.txt dummy"));1636 mr_asprintf(tmp, "a\n%s\n", call_program_and_get_last_line_of_output ("make-me-bootable /tmp/mountlist.txt dummy")); 1637 1637 fput_string_one_char_at_a_time(pout_to_fdisk, tmp); 1638 1638 mr_free(tmp); … … 1644 1644 log_msg(0, 1645 1645 "------------------- fdisk.log looks like this ------------------"); 1646 mr_asprintf( &tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE);1646 mr_asprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE); 1647 1647 system(tmp); 1648 1648 mr_free(tmp); … … 1650 1650 log_msg(0, 1651 1651 "------------------- end of fdisk.log... word! ------------------"); 1652 mr_asprintf( &tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG);1652 mr_asprintf(tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG); 1653 1653 if (!run_program_and_log_output(tmp, 5)) { 1654 1654 g_partition_table_locked_up++; … … 1656 1656 mr_free(tmp); 1657 1657 1658 mr_asprintf( &tmp, "partprobe %s", drivename);1658 mr_asprintf(tmp, "partprobe %s", drivename); 1659 1659 if (!run_program_and_log_output(tmp, 5)) { 1660 1660 g_partition_table_locked_up--; … … 1708 1708 1709 1709 if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) { 1710 mr_asprintf( &tmp, "Not partitioning %s - it is a virtual drive", drive);1710 mr_asprintf(tmp, "Not partitioning %s - it is a virtual drive", drive); 1711 1711 log_it(tmp); 1712 1712 mr_free(tmp); … … 1716 1716 partition_name = build_partition_name(drive, partno); 1717 1717 if (partsize <= 0) { 1718 mr_asprintf( &tmp, "Partitioning device %s (max size)", partition_name);1718 mr_asprintf(tmp, "Partitioning device %s (max size)", partition_name); 1719 1719 } else { 1720 mr_asprintf( &tmp, "Partitioning device %s (%lld MB)", partition_name, (long long) partsize / 1024);1720 mr_asprintf(tmp, "Partitioning device %s (%lld MB)", partition_name, (long long) partsize / 1024); 1721 1721 } 1722 1722 update_progress_form(tmp); … … 1725 1725 1726 1726 if (is_this_device_mounted(partition_name)) { 1727 mr_asprintf( &tmp, "%s is mounted, and should not be partitioned", partition_name);1727 mr_asprintf(tmp, "%s is mounted, and should not be partitioned", partition_name); 1728 1728 log_to_screen(tmp); 1729 1729 mr_free(tmp); … … 1737 1737 /* BERLIOS: should not be called each time */ 1738 1738 part_table_fmt = which_partition_format(drive); 1739 mr_asprintf( &output, "");1739 mr_asprintf(output, ""); 1740 1740 /* make it a primary/extended/logical */ 1741 1741 if (partno <= 4) { … … 1769 1769 } 1770 1770 mr_strcat(output, "\n"); 1771 mr_asprintf( &tmp,"PARTSIZE = +%ld",(long)partsize);1771 mr_asprintf(tmp,"PARTSIZE = +%ld",(long)partsize); 1772 1772 log_it(tmp); 1773 1773 mr_free(tmp); … … 1777 1777 log_it("---end of fdisk---"); 1778 1778 1779 mr_asprintf( &program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE);1779 mr_asprintf(program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE); 1780 1780 if (pout_to_fdisk) { 1781 1781 log_msg(1, "Doing the new all-in-one fdisk thing"); … … 1783 1783 fput_string_one_char_at_a_time(pout_to_fdisk, output); 1784 1784 fput_string_one_char_at_a_time(pout_to_fdisk, "\n\np\n"); 1785 mr_asprintf( &tmp, "%s", last_line_of_file(FDISK_LOG));1785 mr_asprintf(tmp, "%s", last_line_of_file(FDISK_LOG)); 1786 1786 if (strstr(tmp, " (m ")) { 1787 1787 log_msg(1, "Successfully created partition %d on %s", partno, drive); … … 1826 1826 format, -1); 1827 1827 if (res) { 1828 mr_asprintf( &tmp, "Failed to vacuum-pack %s", partition_name);1828 mr_asprintf(tmp, "Failed to vacuum-pack %s", partition_name); 1829 1829 log_it(tmp); 1830 1830 mr_free(tmp); … … 1840 1840 partsize); 1841 1841 if (retval) { 1842 mr_asprintf( &tmp, "Partitioned %s but failed to set its type", partition_name);1842 mr_asprintf(tmp, "Partitioned %s but failed to set its type", partition_name); 1843 1843 log_it(tmp); 1844 1844 mr_free(tmp); 1845 1845 } else { 1846 1846 if (partsize > 0) { 1847 mr_asprintf( &tmp, "Partition %s created+configured OK", partition_name);1847 mr_asprintf(tmp, "Partition %s created+configured OK", partition_name); 1848 1848 log_to_screen(tmp); 1849 1849 mr_free(tmp); … … 1853 1853 } 1854 1854 } else { 1855 mr_asprintf( &tmp, "Failed to partition %s", partition_name);1855 mr_asprintf(tmp, "Failed to partition %s", partition_name); 1856 1856 if (partsize > 0) { 1857 1857 log_to_screen(tmp); … … 1997 1997 p = (char *) strrchr(partition, '/'); 1998 1998 if (strcmp(format, "swap") == 0) { 1999 mr_asprintf( &partcode, "82");1999 mr_asprintf(partcode, "82"); 2000 2000 } else if (strcmp(format, "vfat") == 0) { 2001 2001 if (partsize / 1024 > 8192) { 2002 mr_asprintf( &partcode, "c");2002 mr_asprintf(partcode, "c"); 2003 2003 } else { 2004 mr_asprintf( &partcode, "b");2004 mr_asprintf(partcode, "b"); 2005 2005 } 2006 2006 } else if (strcmp(format, "ext2") == 0 … … 2010 2010 || strcmp(format, "xfs") == 0 2011 2011 || strcmp(format, "jfs") == 0) { 2012 mr_asprintf( &partcode, "83");2012 mr_asprintf(partcode, "83"); 2013 2013 } else if (strcmp(format, "minix") == 0) { 2014 mr_asprintf( &partcode, "81");2014 mr_asprintf(partcode, "81"); 2015 2015 } else if (strcmp(format, "vmfs3") == 0) { 2016 mr_asprintf( &partcode, "fb");2016 mr_asprintf(partcode, "fb"); 2017 2017 } else if (strcmp(format, "vmkcore") == 0) { 2018 mr_asprintf( &partcode, "fc");2018 mr_asprintf(partcode, "fc"); 2019 2019 } else if (strcmp(format, "raid") == 0) { 2020 mr_asprintf( &partcode, "fd");2020 mr_asprintf(partcode, "fd"); 2021 2021 } else if (strcmp(format, "ntfs") == 0) { 2022 mr_asprintf( &partcode, "7");2022 mr_asprintf(partcode, "7"); 2023 2023 } else if ((strcmp(format, "ufs") == 0) 2024 2024 || (strcmp(format, "ffs") == 0)) { /* raid autodetect */ 2025 mr_asprintf( &partcode, "a5");2025 mr_asprintf(partcode, "a5"); 2026 2026 } else if (strcmp(format, "lvm") == 0) { 2027 mr_asprintf( &partcode, "8e");2027 mr_asprintf(partcode, "8e"); 2028 2028 } else if (format[0] == '\0') { /* LVM physical partition */ 2029 mr_asprintf( &partcode, "");2029 mr_asprintf(partcode, ""); 2030 2030 } else if (strlen(format) >= 1 && strlen(format) <= 2) { 2031 mr_asprintf( &partcode, format);2031 mr_asprintf(partcode, format); 2032 2032 } else { 2033 2033 /* probably an image */ 2034 mr_asprintf( &tmp, "Unknown format ('%s') - using supplied string anyway", format);2034 mr_asprintf(tmp, "Unknown format ('%s') - using supplied string anyway", format); 2035 2035 mvaddstr_and_log_it(g_currentY++, 0, tmp); 2036 2036 mr_free(tmp); 2037 2037 #ifdef __FreeBSD__ 2038 mr_asprintf( &partcode, format); // was a52038 mr_asprintf(partcode, format); // was a5 2039 2039 #else 2040 mr_asprintf( &partcode, format); // was 832040 mr_asprintf(partcode, format); // was 83 2041 2041 #endif 2042 2042 } … … 2052 2052 || strstr(last_line_of_file(FDISK_LOG), " (1-4)")) { 2053 2053 log_msg(5, "Specifying partno (%d) - yay", partno); 2054 mr_asprintf( &tmp, "%d\n", partno);2054 mr_asprintf(tmp, "%d\n", partno); 2055 2055 fput_string_one_char_at_a_time(pout_to_fdisk, tmp); 2056 2056 mr_free(tmp); … … 2060 2060 } 2061 2061 2062 mr_asprintf( &tmp, "%s\n", partcode);2062 mr_asprintf(tmp, "%s\n", partcode); 2063 2063 fput_string_one_char_at_a_time(pout_to_fdisk, tmp); 2064 2064 mr_free(tmp); … … 2070 2070 last_line_of_file(FDISK_LOG)); 2071 2071 2072 mr_asprintf( &tmp, "%s", last_line_of_file(FDISK_LOG));2072 mr_asprintf(tmp, "%s", last_line_of_file(FDISK_LOG)); 2073 2073 if (!strstr(tmp, " (m ")) { 2074 2074 log_msg(1, "last line = '%s'; part type set failed", tmp); … … 2080 2080 fput_string_one_char_at_a_time(pout_to_fdisk, "p\n"); 2081 2081 } else { 2082 mr_asprintf( &output, "t\n%d\n%s\nw\n", partno, partcode);2083 mr_asprintf( &command, "parted2fdisk %s >> %s 2>> %s", drive,2082 mr_asprintf(output, "t\n%d\n%s\nw\n", partno, partcode); 2083 mr_asprintf(command, "parted2fdisk %s >> %s 2>> %s", drive, 2084 2084 MONDO_LOGFILE, MONDO_LOGFILE); 2085 2085 log_msg(5, "output = '%s'", output); … … 2123 2123 return 1; 2124 2124 } 2125 mr_asprintf( &program, "vinum start -f %s", raid_device);2125 mr_asprintf(program, "vinum start -f %s", raid_device); 2126 2126 #else 2127 mr_asprintf( &program, "raidstart %s", raid_device);2127 mr_asprintf(program, "raidstart %s", raid_device); 2128 2128 #endif 2129 2129 log_msg(1, "program = %s", program); … … 2168 2168 return 1; 2169 2169 } 2170 mr_asprintf( &program, "vinum stop -f %s", raid_device);2170 mr_asprintf(program, "vinum stop -f %s", raid_device); 2171 2171 #else 2172 2172 // use raidstop if it exists, otherwise use mdadm 2173 2173 if (run_program_and_log_output("which raidstop", FALSE)) { 2174 mr_asprintf( &program, "mdadm -S %s", raid_device);2174 mr_asprintf(program, "mdadm -S %s", raid_device); 2175 2175 } else { 2176 mr_asprintf( &program, "raidstop %s", raid_device);2176 mr_asprintf(program, "raidstop %s", raid_device); 2177 2177 } 2178 2178 #endif … … 2320 2320 if (strcmp(format, "swap") == 0) { 2321 2321 #ifdef __FreeBSD__ 2322 mr_asprintf( &program, "true");2322 mr_asprintf(program, "true"); 2323 2323 #else 2324 mr_asprintf( &program, "mkswap");2324 mr_asprintf(program, "mkswap"); 2325 2325 #endif 2326 2326 } else if (strcmp(format, "vfat") == 0) { 2327 mr_asprintf( &program, "format-and-kludge-vfat");2327 mr_asprintf(program, "format-and-kludge-vfat"); 2328 2328 #ifndef __FreeBSD__ 2329 2329 } else if (strcmp(format, "reiserfs") == 0) { 2330 mr_asprintf( &program, "mkreiserfs -ff");2330 mr_asprintf(program, "mkreiserfs -ff"); 2331 2331 } else if (strcmp(format, "xfs") == 0) { 2332 mr_asprintf( &program, "mkfs.xfs -f -q");2332 mr_asprintf(program, "mkfs.xfs -f -q"); 2333 2333 } else if (strcmp(format, "jfs") == 0) { 2334 mr_asprintf( &program, "mkfs.jfs");2334 mr_asprintf(program, "mkfs.jfs"); 2335 2335 } else if (strcmp(format, "ext3") == 0) { 2336 mr_asprintf( &program, "mkfs -t ext3 -F -q");2336 mr_asprintf(program, "mkfs -t ext3 -F -q"); 2337 2337 } else if (strcmp(format, "ext4") == 0) { 2338 mr_asprintf( &program, "mkfs -t ext4 -F -q");2338 mr_asprintf(program, "mkfs -t ext4 -F -q"); 2339 2339 } else if (strcmp(format, "minix") == 0) { 2340 mr_asprintf( &program, "mkfs.minix");2340 mr_asprintf(program, "mkfs.minix"); 2341 2341 } else if (strcmp(format, "vmfs") == 0) { 2342 mr_asprintf( &program, "mkfs -t vmfs");2342 mr_asprintf(program, "mkfs -t vmfs"); 2343 2343 } else if (strcmp(format, "ntfs") == 0) { 2344 2344 /* … … 2346 2346 * so the default "mkfs -t %s -c" command structure fails 2347 2347 */ 2348 mr_asprintf( &program, "mkfs -t ntfs");2348 mr_asprintf(program, "mkfs -t ntfs"); 2349 2349 } else if (strcmp(format, "ocfs2") == 0) { 2350 2350 /* … … 2352 2352 * 2353 2353 */ 2354 mr_asprintf( &program, "mkfs -t ocfs2 -F");2354 mr_asprintf(program, "mkfs -t ocfs2 -F"); 2355 2355 #endif 2356 2356 } else if (strcmp(format, "ext2") == 0) { 2357 mr_asprintf( &program, "mke2fs -F -q");2357 mr_asprintf(program, "mke2fs -F -q"); 2358 2358 } else { 2359 2359 #ifdef __FreeBSD__ 2360 mr_asprintf( &program, "newfs_%s", format);2360 mr_asprintf(program, "newfs_%s", format); 2361 2361 #else 2362 mr_asprintf( &program, "mkfs -t %s -c", format); // -c checks for bad blocks2363 #endif 2364 mr_asprintf( &tmp, "Unknown format (%s) - assuming '%s' will do", format, program);2362 mr_asprintf(program, "mkfs -t %s -c", format); // -c checks for bad blocks 2363 #endif 2364 mr_asprintf(tmp, "Unknown format (%s) - assuming '%s' will do", format, program); 2365 2365 log_it(tmp); 2366 2366 mr_free(tmp); … … 2425 2425 return; 2426 2426 } 2427 mr_asprintf( &tmp, "Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive);2427 mr_asprintf(tmp, "Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive); 2428 2428 log_to_screen(tmp); 2429 2429 mr_free(tmp); … … 2445 2445 2446 2446 if (original_size_of_drive <= 0) { 2447 mr_asprintf( &tmp, "Cannot resize %s's entries. Drive not found.", drive_name);2447 mr_asprintf(tmp, "Cannot resize %s's entries. Drive not found.", drive_name); 2448 2448 log_to_screen(tmp); 2449 2449 mr_free(tmp); … … 2451 2451 } 2452 2452 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);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 2454 log_to_screen(tmp); 2455 2455 mr_free(tmp); … … 2478 2478 } 2479 2479 2480 mr_asprintf( &tmp, "Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);2480 mr_asprintf(tmp, "Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL); 2481 2481 log_to_screen(tmp); 2482 2482 mr_free(tmp); … … 2484 2484 } 2485 2485 final_size = get_phys_size_of_drive(drive_name); 2486 mr_asprintf( &tmp, "final_size = %ld MB", final_size);2486 mr_asprintf(tmp, "final_size = %ld MB", final_size); 2487 2487 log_to_screen(tmp); 2488 2488 mr_free(tmp); -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c
r2321 r2323 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.");81 mr_asprintf(tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob."); 82 82 log_msg(2, tmp_ptr); 83 83 paranoid_free(tmp_ptr); … … 86 86 } 87 87 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);88 mr_asprintf(tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr); 89 89 log_to_screen(tmp_ptr); 90 90 paranoid_free(tmp_ptr); … … 101 101 102 102 if (!g_text_mode) { 103 mr_asprintf( &tmp_ptr, "Comparing %s", bigfile_fname_ptr);103 mr_asprintf(tmp_ptr, "Comparing %s", bigfile_fname_ptr); 104 104 newtDrawRootText(0, 22, tmp_ptr); 105 105 paranoid_free(tmp_ptr); … … 120 120 mr_free(command_ptr); 121 121 122 mr_asprintf( &tmp_ptr, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);122 mr_asprintf(tmp_ptr, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE); 123 123 paranoid_system(tmp_ptr); 124 124 paranoid_free(tmp_ptr); … … 146 146 } 147 147 } 148 mr_asprintf( &tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr);148 mr_asprintf(tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr); 149 149 if (!strcmp(checksum_ptr, original_cksum_ptr) != 0) { 150 150 mr_strcat(tmp_ptr, " ... OK"); … … 274 274 275 275 if (use_star) { 276 mr_asprintf( &archiver_exe, "star");277 } else { 278 mr_asprintf( &archiver_exe, "afio");276 mr_asprintf(archiver_exe, "star"); 277 } else { 278 mr_asprintf(archiver_exe, "afio"); 279 279 } 280 280 -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-newt.c
r2316 r2323 472 472 char *prompt = NULL; 473 473 474 mr_asprintf( &prompt, "Please enter the RAID level you want. (concat, striped, raid5)");474 mr_asprintf(prompt, "Please enter the RAID level you want. (concat, striped, raid5)"); 475 475 if (raidrec->raidlevel == -1) { 476 mr_asprintf( &tmp, "concat");476 mr_asprintf(tmp, "concat"); 477 477 } else if (raidrec->raidlevel == 0) { 478 mr_asprintf( &tmp, "striped");478 mr_asprintf(tmp, "striped"); 479 479 } else { 480 mr_asprintf( &tmp, "raid%i", raidrec->raidlevel);480 mr_asprintf(tmp, "raid%i", raidrec->raidlevel); 481 481 } 482 482 for (out = 999; out == 999;) { … … 538 538 539 539 system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null"); 540 mr_asprintf( &personalities, "%s", last_line_of_file("/tmp/raid-personalities.txt"));541 mr_asprintf( &prompt, "Please enter the RAID level you want. %s", personalities);540 mr_asprintf(personalities, "%s", last_line_of_file("/tmp/raid-personalities.txt")); 541 mr_asprintf(prompt, "Please enter the RAID level you want. %s", personalities); 542 542 mr_free(personalities); 543 543 544 544 if (raidrec->raid_level == -1) { 545 mr_asprintf( &tmp, "linear");545 mr_asprintf(tmp, "linear"); 546 546 } else { 547 mr_asprintf( &tmp, "%d", raidrec->raid_level);547 mr_asprintf(tmp, "%d", raidrec->raid_level); 548 548 } 549 549 for (out = 999; … … 1850 1850 char *tmp = NULL; 1851 1851 1852 mr_asprintf( &tmp, "%i", raidrec->stripesize);1852 mr_asprintf(tmp, "%i", raidrec->stripesize); 1853 1853 p = popup_and_get_string("Stripe size", "Please enter the stripe size in kilobytes.", tmp); 1854 1854 mr_free(tmp); … … 1899 1899 assert(lino >= 0); 1900 1900 1901 mr_asprintf( &sz_out, "%s", raidrec->additional_vars.el[lino].value);1902 mr_asprintf( &header, "Edit %s", raidrec->additional_vars.el[lino].label);1903 mr_asprintf( &comment, "Please set %s's value (currently '%s')", raidrec->additional_vars.el[lino].label, sz_out);1901 mr_asprintf(sz_out, "%s", raidrec->additional_vars.el[lino].value); 1902 mr_asprintf(header, "Edit %s", raidrec->additional_vars.el[lino].label); 1903 mr_asprintf(comment, "Please set %s's value (currently '%s')", raidrec->additional_vars.el[lino].label, sz_out); 1904 1904 p = popup_and_get_string(header, comment, sz_out); 1905 1905 if (p != NULL) { … … 1957 1957 assert(raidlist != NULL); 1958 1958 1959 mr_asprintf( &flaws_str_A, "%s", " ");1960 mr_asprintf( &flaws_str_B, "%s", " ");1961 mr_asprintf( &flaws_str_C, "%s", " ");1959 mr_asprintf(flaws_str_A, "%s", " "); 1960 mr_asprintf(flaws_str_B, "%s", " "); 1961 mr_asprintf(flaws_str_C, "%s", " "); 1962 1962 if (mountlist->entries > ARBITRARY_MAXIMUM) { 1963 1963 log_to_screen("Arbitrary limits suck, man!"); … … 2283 2283 log_it("isodir_path = %s", isodir_path); 2284 2284 if (isodir_device[0] == '\0') { 2285 mr_asprintf( &idev, "/dev/");2285 mr_asprintf(idev, "/dev/"); 2286 2286 } else { 2287 mr_asprintf(&idev, "%s", isodir_device); 2288 } 2289 2290 if (isodir_path[0] == '\0') { 2291 strcpy(isodir_path, "/"); 2292 } 2287 mr_asprintf(idev, "%s", isodir_device); 2288 } 2289 2293 2290 if (does_file_exist("/tmp/NFS-SERVER-PATH")) { 2294 2291 mr_free(idev); 2295 mr_asprintf(&idev, "%s", last_line_of_file("/tmp/NFS-SERVER-MOUNT")); 2296 mr_asprintf(&isodir_format, "nfs"); 2297 strcpy(isodir_path, last_line_of_file("/tmp/NFS-SERVER-PATH")); 2292 mr_asprintf(idev, "%s", last_line_of_file("/tmp/NFS-SERVER-MOUNT")); 2293 mr_asprintf(isodir_format, "nfs"); 2294 mr_free(isodir_path); 2295 mr_asprintf(isodir_path, "%s", last_line_of_file("/tmp/NFS-SERVER-PATH")); 2298 2296 } 2299 2297 … … 2319 2317 /* modify for the caller */ 2320 2318 strcpy(isodir_device, p); 2321 strcpy(isodir_path, r); 2319 mr_free(isodir_path); 2320 isodir_path = r; 2322 2321 log_it("isodir_device = %s - isodir_format = %s - isodir_path = %s", isodir_device, isodir_format, isodir_path); 2323 mr_free(r);2324 2322 2325 2323 ret = TRUE; … … 2770 2768 2771 2769 log_it("Post-malloc"); 2772 mr_asprintf( &help_text, " Edit this RAID device's list of partitions. Choose OK or Cancel when done.");2773 mr_asprintf( &header_text, "%-24s %s", "Device", "Index");2774 mr_asprintf( &title_of_window, "%s contains...", raidrec->raid_device);2770 mr_asprintf(help_text, " Edit this RAID device's list of partitions. Choose OK or Cancel when done."); 2771 mr_asprintf(header_text, "%-24s %s", "Device", "Index"); 2772 mr_asprintf(title_of_window, "%s contains...", raidrec->raid_device); 2775 2773 newtPushHelpLine(help_text); 2776 2774 for (b_res = (newtComponent) 12345; b_res != bOK && b_res != bCancel;) { … … 2827 2825 redraw_disklist(disklist, keylist, partitionsListbox); 2828 2826 } else { 2829 mr_asprintf( &tmp, "%s's index is %d. What should it be?", raidrec->raid_device, disklist->el[currline].index);2830 mr_asprintf( &sz_res, "%d", disklist->el[currline].index);2827 mr_asprintf(tmp, "%s's index is %d. What should it be?", raidrec->raid_device, disklist->el[currline].index); 2828 mr_asprintf(sz_res, "%d", disklist->el[currline].index); 2831 2829 p = popup_and_get_string("Set index", tmp, sz_res); 2832 2830 mr_free(tmp); -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2322 r2323 144 144 } 145 145 146 mr_asprintf( &question_ptr, "Should I restore the image of %s ?", incoming_ptr);146 mr_asprintf(question_ptr, "Should I restore the image of %s ?", incoming_ptr); 147 147 148 148 if (ask_me_yes_or_no(question_ptr)) { … … 228 228 } 229 229 log_msg(2, "Checking to see if f=%s, file=%s, is in the list of biggiefiles", f, file); 230 mr_asprintf( &command, "grep -E '^%s$' %s", file, list_fname);230 mr_asprintf(command, "grep -E '^%s$' %s", file, list_fname); 231 231 res = run_program_and_log_output(command, FALSE); 232 232 mr_free(command); … … 260 260 char *command = NULL; 261 261 char *mds = NULL; 262 char *p = NULL; 262 263 int retval = 0, i; 263 264 bool already_mounted = FALSE; 264 265 char *isodir_format = NULL; 265 266 266 assert(bkpinfo != NULL);267 267 g_ISO_restore_mode = TRUE; 268 268 read_cfg_var(g_mondo_cfg_file, "iso-dev", g_isodir_device); … … 271 271 * Don't let this clobber an existing bkpinfo->isodir */ 272 272 if (!bkpinfo->isodir[0]) { 273 strcpy(bkpinfo->isodir, "/tmp/isodir"); 273 mr_free(bkpinfo->isodir); 274 mr_asprintf(p, "/tmp/isodir"); 275 bkpinfo->isodir = p; 274 276 } 275 277 /* End patch */ 276 mr_asprintf( &command, "mkdir -p %s", bkpinfo->isodir);278 mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir); 277 279 run_program_and_log_output(command, 5); 278 280 mr_free(command); … … 290 292 already_mounted = TRUE; 291 293 } else { 292 mr_asprintf( &mount_isodir_command, "mount %s", g_isodir_device);294 mr_asprintf(mount_isodir_command, "mount %s", g_isodir_device); 293 295 if (isodir_format) { 294 296 mr_strcat(mount_isodir_command, " -t %s", isodir_format); … … 320 322 log_msg(1, "%s #%d has been mounted via loopback mount", mds, i); 321 323 if (i < 0) { 322 popup_and_OK 323 ("Cannot find ISO images in the directory you specified."); 324 retval = 1; 325 } 326 log_msg(2, "%ld: bkpinfo->isodir is now %s", __LINE__, 327 bkpinfo->isodir); 324 popup_and_OK("Cannot find ISO images in the directory you specified."); 325 retval = 1; 326 } 327 log_msg(2, "bkpinfo->isodir is now %s", bkpinfo->isodir); 328 328 return (retval); 329 329 } … … 368 368 369 369 if (!strcmp(mpt, "/1")) { 370 mr_asprintf( &mountpoint, "/");370 mr_asprintf(mountpoint, "/"); 371 371 log_msg(3, "Mommm! SME is being a dildo!"); 372 372 } else { 373 mr_asprintf( &mountpoint, "%s", mpt);373 mr_asprintf(mountpoint, "%s", mpt); 374 374 } 375 375 … … 380 380 return (0); 381 381 } 382 mr_asprintf( &tmp, "Mounting device %s ", device);382 mr_asprintf(tmp, "Mounting device %s ", device); 383 383 log_msg(1, tmp); 384 384 /* Deal with additional params only if not /proc or /sys */ 385 mr_asprintf( &additional_parameters, "");385 mr_asprintf(additional_parameters, ""); 386 386 if (strcmp(format, "proc") && strcmp(format, "sys")) { 387 387 if (writeable) { … … 399 399 400 400 if (!strcmp(mountpoint, "swap")) { 401 mr_asprintf( &command, "swapon %s", device);402 mr_asprintf( &mountdir, "swap");401 mr_asprintf(command, "swapon %s", device); 402 mr_asprintf(mountdir, "swap"); 403 403 } else { 404 404 if (!strcmp(mountpoint, "/")) { 405 mr_asprintf( &mountdir, "%s", MNT_RESTORING);405 mr_asprintf(mountdir, "%s", MNT_RESTORING); 406 406 } else { 407 mr_asprintf( &mountdir, "%s%s", MNT_RESTORING, mountpoint);408 } 409 mr_asprintf( &command, "mkdir -p %s", mountdir);407 mr_asprintf(mountdir, "%s%s", MNT_RESTORING, mountpoint); 408 } 409 mr_asprintf(command, "mkdir -p %s", mountdir); 410 410 run_program_and_log_output(command, FALSE); 411 411 mr_free(command); 412 412 413 mr_asprintf( &command, "mount -t %s %s %s %s 2>> %s", format, device, additional_parameters, mountdir, MONDO_LOGFILE);413 mr_asprintf(command, "mount -t %s %s %s %s 2>> %s", format, device, additional_parameters, mountdir, MONDO_LOGFILE); 414 414 log_msg(2, "command='%s'", command); 415 415 } … … 420 420 log_msg(1, "Re-trying without the fancy extra parameters"); 421 421 mr_free(command); 422 mr_asprintf( &command, "mount -t %s %s %s 2>> %s", format, device, mountdir, MONDO_LOGFILE);422 mr_asprintf(command, "mount -t %s %s %s 2>> %s", format, device, mountdir, MONDO_LOGFILE); 423 423 res = run_program_and_log_output(command, TRUE); 424 424 } … … 432 432 log_msg(2, "Retrying w/o the '-t' switch"); 433 433 mr_free(command); 434 mr_asprintf( &command, "mount %s %s 2>> %s", device, mountdir, MONDO_LOGFILE);434 mr_asprintf(command, "mount %s %s 2>> %s", device, mountdir, MONDO_LOGFILE); 435 435 log_msg(2, "2nd command = '%s'", command); 436 436 res = run_program_and_log_output(command, TRUE); … … 492 492 "", mountlist->entries); 493 493 494 mr_asprintf( &these_failed, "");494 mr_asprintf(these_failed, ""); 495 495 for (lino = 0; lino < mountlist->entries; lino++) { 496 496 if (!strcmp(mountlist->el[lino].device, "/proc")) { … … 498 498 "Again with the /proc - why is this in your mountlist?"); 499 499 } else if (is_this_device_mounted(mountlist->el[lino].device)) { 500 mr_asprintf( &tmp, "%s is already mounted", mountlist->el[lino].device);500 mr_asprintf(tmp, "%s is already mounted", mountlist->el[lino].device); 501 501 log_to_screen(tmp); 502 502 mr_free(tmp); … … 505 505 && strcmp(mountlist->el[lino].mountpoint, "raid") 506 506 && strcmp(mountlist->el[lino].mountpoint, "image")) { 507 mr_asprintf( &tmp, "Mounting %s", mountlist->el[lino].device);507 mr_asprintf(tmp, "Mounting %s", mountlist->el[lino].device); 508 508 update_progress_form(tmp); 509 509 mr_free(tmp); … … 529 529 ("format and restore *without* partitioning first. Sorry for the inconvenience."); 530 530 } 531 mr_asprintf( &tmp, "Could not mount device(s) %s- shall I abort?", these_failed);531 mr_asprintf(tmp, "Could not mount device(s) %s- shall I abort?", these_failed); 532 532 533 533 if (!ask_me_yes_or_no(tmp)) { … … 570 570 * @return 0 for success, nonzero for failure. 571 571 */ 572 int mount_media() 573 { 574 char *mount_cmd = NULL; 575 int i, res; 572 int mount_media() { 573 574 char *mount_cmd = NULL; 575 char *p = NULL; 576 int i, res; 576 577 #ifdef __FreeBSD__ 577 char mdd[32];578 char *mddev = mdd;578 char mdd[32]; 579 char *mddev = mdd; 579 580 #endif 580 581 581 assert(bkpinfo != NULL); 582 583 if (bkpinfo->backup_media_type == tape 584 || bkpinfo->backup_media_type == udev) { 582 if (bkpinfo->backup_media_type == tape || bkpinfo->backup_media_type == udev) { 585 583 log_msg(8, "Tape/udev. Therefore, no need to mount a media."); 586 584 return 0; … … 595 593 log_msg(2, "Mounting for NFS thingy"); 596 594 log_msg(2, "isodir = %s", bkpinfo->isodir); 597 if ((!bkpinfo->isodir[0] || !strcmp(bkpinfo->isodir, "/")) 598 && am_I_in_disaster_recovery_mode()) { 599 strcpy(bkpinfo->isodir, "/tmp/isodir"); 595 if (!strcmp(bkpinfo->isodir, "/") && am_I_in_disaster_recovery_mode()) { 596 mr_free(bkpinfo->isodir); 597 mr_asprintf(p, "/tmp/isodir"); 598 bkpinfo->isodir = p; 600 599 log_msg(1, "isodir is being set to %s", bkpinfo->isodir); 601 600 } 602 601 #ifdef __FreeBSD__ 603 mr_asprintf( &mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);602 mr_asprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number); 604 603 mddev = make_vn(mount_cmd); 605 604 mr_free(mount_cmd); 606 605 607 mr_asprintf( &mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev);606 mr_asprintf(mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev); 608 607 #else 609 mr_asprintf( &mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);608 mr_asprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM); 610 609 #endif 611 610 612 611 } else if (bkpinfo->backup_media_type == iso) { 613 612 #ifdef __FreeBSD__ 614 mr_asprintf( &mount_cmd, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number);613 mr_asprintf(mount_cmd, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number); 615 614 mddev = make_vn(mount_cmd); 616 615 mr_free(mount_cmd); 617 616 618 mr_asprintf( &mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM);617 mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM); 619 618 #else 620 mr_asprintf( &mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);619 mr_asprintf(mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM); 621 620 #endif 622 621 } else if (bkpinfo->backup_media_type == usb) { 623 mr_asprintf( &mount_cmd, "mount -t vfat %s %s", bkpinfo->media_device, MNT_CDROM);622 mr_asprintf(mount_cmd, "mount -t vfat %s %s", bkpinfo->media_device, MNT_CDROM); 624 623 } else if (strstr(bkpinfo->media_device, "/dev/")) { 625 624 #ifdef __FreeBSD__ 626 mr_asprintf( &mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM);625 mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM); 627 626 #else 628 mr_asprintf( &mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM);627 mr_asprintf(mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM); 629 628 #endif 630 629 } else { … … 638 637 639 638 #ifdef __FreeBSD__ 640 mr_asprintf( &mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM);639 mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM); 641 640 #else 642 mr_asprintf( &mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM);641 mr_asprintf(mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM); 643 642 #endif 644 643 } … … 727 726 malloc_string(iso_mnt); 728 727 malloc_string(iso_path); 729 malloc_string(old_isodir);730 728 malloc_string(value); 731 729 malloc_string(tmp); … … 774 772 mr_free(bkpinfo->prefix); 775 773 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 776 mr_asprintf( &tmp1, "%s", value);774 mr_asprintf(tmp1, "%s", value); 777 775 } else { 778 mr_asprintf( &tmp1, "%s", STD_PREFIX);776 mr_asprintf(tmp1, "%s", STD_PREFIX); 779 777 } 780 778 bkpinfo->prefix = tmp1; … … 784 782 mr_free(bkpinfo->prefix); 785 783 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 786 mr_asprintf( &tmp1, "%s", value);784 mr_asprintf(tmp1, "%s", value); 787 785 } else { 788 mr_asprintf( &tmp1, "%s", STD_PREFIX);786 mr_asprintf(tmp1, "%s", STD_PREFIX); 789 787 } 790 788 bkpinfo->prefix = tmp1; … … 798 796 } 799 797 mr_free(bkpinfo->prefix); 800 mr_asprintf( &tmp1, "%s", envtmp1);798 mr_asprintf(tmp1, "%s", envtmp1); 801 799 bkpinfo->prefix = tmp1; 802 800 } … … 863 861 read_cfg_var(cfg_file, "acl", value); 864 862 if (strstr(value, "TRUE")) { 865 mr_asprintf( &g_getfacl,"setfacl");863 mr_asprintf(g_getfacl,"setfacl"); 866 864 log_msg(1, "We will restore ACLs"); 867 865 if (! find_home_of_exe("setfacl")) { … … 871 869 read_cfg_var(cfg_file, "xattr", value); 872 870 if (strstr(value, "TRUE")) { 873 mr_asprintf( &g_getfattr,"setfattr");871 mr_asprintf(g_getfattr,"setfattr"); 874 872 log_msg(1, "We will restore XATTRs"); 875 873 if (! find_home_of_exe("setfattr")) { … … 968 966 * isodir in disaster recovery mode 969 967 */ 970 strcpy(old_isodir, bkpinfo->isodir);968 mr_asprintf(old_isodir, "%s", bkpinfo->isodir); 971 969 read_cfg_var(g_mondo_cfg_file, "iso-mnt", iso_mnt); 972 970 read_cfg_var(g_mondo_cfg_file, "isodir", iso_path); 973 sprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path); 971 mr_free(bkpinfo->isodir); 972 mr_asprintf(tmp1, "%s%s", iso_mnt, iso_path); 973 bkpinfo->isodir = tmp1; 974 974 if (!bkpinfo->isodir[0]) { 975 strcpy(bkpinfo->isodir, old_isodir); 975 mr_free(bkpinfo->isodir); 976 bkpinfo->isodir = old_isodir; 977 } else { 978 mr_free(old_isodir); 976 979 } 977 980 if (!bkpinfo->disaster_recovery) { 978 981 if (strcmp(old_isodir, bkpinfo->isodir)) { 979 log_it 980 ("user nominated isodir differs from archive, keeping user's choice: %s %s\n", 981 old_isodir, bkpinfo->isodir); 982 strcpy(bkpinfo->isodir, old_isodir); 982 log_it("user nominated isodir %s differs from archive, keeping user's choice: %s\n", bkpinfo->isodir, old_isodir ); 983 mr_free(bkpinfo->isodir); 984 bkpinfo->isodir = old_isodir; 985 } else { 986 mr_free(old_isodir); 983 987 } 984 988 } 985 989 read_cfg_var(g_mondo_cfg_file, "iso-dev", g_isodir_device); 986 log_msg(2, "isodir=%s; iso-dev=%s", bkpinfo->isodir, 987 g_isodir_device); 990 log_msg(2, "isodir=%s; iso-dev=%s", bkpinfo->isodir, g_isodir_device); 991 988 992 if (bkpinfo->disaster_recovery) { 989 993 if (is_this_device_mounted(g_isodir_device)) { 990 994 log_msg(2, "NB: isodir is already mounted"); 991 995 /* Find out where it's mounted */ 992 mr_asprintf( &command, "mount | grep -E '^%s' | tail -n1 | cut -d' ' -f3", g_isodir_device);996 mr_asprintf(command, "mount | grep -E '^%s' | tail -n1 | cut -d' ' -f3", g_isodir_device); 993 997 log_it("command = %s", command); 994 998 log_it("res of it = %s", call_program_and_get_last_line_of_output(command)); … … 997 1001 } else { 998 1002 sprintf(iso_mnt, "/tmp/isodir"); 999 mr_asprintf( &tmp1, "mkdir -p %s", iso_mnt);1003 mr_asprintf(tmp1, "mkdir -p %s", iso_mnt); 1000 1004 run_program_and_log_output(tmp1, 5); 1001 1005 mr_free(tmp1); 1002 1006 1003 mr_asprintf( &tmp1, "mount %s %s", g_isodir_device, iso_mnt);1007 mr_asprintf(tmp1, "mount %s %s", g_isodir_device, iso_mnt); 1004 1008 if (run_program_and_log_output(tmp1, 3)) { 1005 1009 log_msg(1, … … 1007 1011 bkpinfo->backup_media_type = cdr; 1008 1012 strcpy(bkpinfo->media_device, "/dev/cdrom"); /* superfluous */ 1009 bkpinfo->isodir[0] =iso_mnt[0] = iso_path[0] = '\0';1013 iso_mnt[0] = iso_path[0] = '\0'; 1010 1014 if (mount_media()) { 1011 1015 mr_free(tmp1); 1012 fatal_error 1013 ("Unable to mount isodir. Failed to mount CD-ROM as well."); 1016 fatal_error("Unable to mount isodir. Failed to mount CD-ROM as well."); 1014 1017 } else { 1015 log_msg(1, 1016 "You backed up to disk, then burned some CDs."); 1018 log_msg(1, "You backed up to disk, then burned some CDs."); 1017 1019 } 1018 1020 } … … 1021 1023 /* bkpinfo->isodir should now be the true path to prefix-1.iso etc... */ 1022 1024 if (bkpinfo->backup_media_type == iso) { 1023 sprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path); 1025 mr_free(bkpinfo->isodir); 1026 mr_asprintf(tmp1, "%s%s", iso_mnt, iso_path); 1027 bkpinfo->isodir = tmp1; 1024 1028 } 1025 1029 } … … 1047 1051 paranoid_free(iso_mnt); 1048 1052 paranoid_free(iso_path); 1049 paranoid_free(old_isodir);1050 1053 return (0); 1051 1054 … … 1105 1108 unlink(FILELIST_FULL_STUB); 1106 1109 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1107 mr_asprintf( &command, "tar -b %ld -zxf %s ./%s ./%s ./%s ./%s ./%s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);1110 mr_asprintf(command, "tar -b %ld -zxf %s ./%s ./%s ./%s ./%s ./%s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB); 1108 1111 log_msg(1, "tarcommand = %s", command); 1109 1112 run_program_and_log_output(command, 1); … … 1113 1116 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 1114 1117 log_msg(2, "pre-2.2.4 compatible mode on"); 1115 mr_asprintf( &command, "tar -b %ld -zxf %s %s %s %s %s %s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);1118 mr_asprintf(command, "tar -b %ld -zxf %s %s %s %s %s %s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB); 1116 1119 log_msg(1, "tarcommand = %s", command); 1117 1120 run_program_and_log_output(command, 1); … … 1119 1122 } 1120 1123 } else { 1121 log_msg(2, 1122 "Calling insist_on_this_cd_number; bkpinfo->isodir=%s", 1123 bkpinfo->isodir); 1124 log_msg(2, "Calling insist_on_this_cd_number; bkpinfo->isodir=%s", bkpinfo->isodir); 1124 1125 insist_on_this_cd_number(1); 1125 1126 log_msg(2, "Back from iotcn"); 1126 1127 run_program_and_log_output("mount", 1); 1127 mr_asprintf( &command, "tar -zxf %s/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);1128 mr_asprintf(command, "tar -zxf %s/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB); 1128 1129 1129 1130 log_msg(1, "tarcommand = %s", command); … … 1134 1135 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 1135 1136 log_msg(2, "pre-2.2.4 compatible mode on"); 1136 mr_asprintf( &command, "tar -zxf %s/images/all.tar.gz %s %s %s %s %s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);1137 mr_asprintf(command, "tar -zxf %s/images/all.tar.gz %s %s %s %s %s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB); 1137 1138 1138 1139 log_msg(1, "tarcommand = %s", command); … … 1149 1150 } 1150 1151 } 1151 mr_asprintf( &command, "cp -f %s %s", MONDO_CFG_FILE_STUB, g_mondo_cfg_file);1152 mr_asprintf(command, "cp -f %s %s", MONDO_CFG_FILE_STUB, g_mondo_cfg_file); 1152 1153 run_program_and_log_output(command, FALSE); 1153 1154 mr_free(command); 1154 1155 1155 mr_asprintf( &command, "cp -f %s/%s %s", bkpinfo->tmpdir, BIGGIELIST_TXT_STUB, g_biggielist_txt);1156 mr_asprintf(command, "cp -f %s/%s %s", bkpinfo->tmpdir, BIGGIELIST_TXT_STUB, g_biggielist_txt); 1156 1157 log_msg(1, "command = %s", command); 1157 1158 paranoid_system(command); 1158 1159 mr_free(command); 1159 1160 1160 mr_asprintf( &command, "ln -sf %s/%s %s", bkpinfo->tmpdir, FILELIST_FULL_STUB, g_filelist_full);1161 mr_asprintf(command, "ln -sf %s/%s %s", bkpinfo->tmpdir, FILELIST_FULL_STUB, g_filelist_full); 1161 1162 log_msg(1, "command = %s", command); 1162 1163 paranoid_system(command); … … 1170 1171 && 1171 1172 ask_me_yes_or_no("Do you want to retrieve the mountlist as well?")) { 1172 mr_asprintf( &command, "ln -sf %s/%s /tmp", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir);1173 mr_asprintf(command, "ln -sf %s/%s /tmp", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir); 1173 1174 paranoid_system(command); 1174 1175 mr_free(command); … … 1195 1196 log_to_screen("Pre-processing filelist"); 1196 1197 if (!does_file_exist(g_biggielist_txt)) { 1197 mr_asprintf( &command, "echo -n > %s", g_biggielist_txt);1198 mr_asprintf(command, "echo -n > %s", g_biggielist_txt); 1198 1199 paranoid_system(command); 1199 1200 mr_free(command); 1200 1201 } 1201 mr_asprintf( &command, "grep -E '^/dev/.*' %s > %s", g_biggielist_txt, g_filelist_imagedevs);1202 mr_asprintf(command, "grep -E '^/dev/.*' %s > %s", g_biggielist_txt, g_filelist_imagedevs); 1202 1203 paranoid_system(command); 1203 1204 mr_free(command); … … 1276 1277 assert_string_is_neither_NULL_nor_zerolength(filename); 1277 1278 1278 mr_asprintf( &tmp, "%s/%s", path_root, filename);1279 mr_asprintf( &command, "cp -f %s %s.pristine", tmp, tmp);1279 mr_asprintf(tmp, "%s/%s", path_root, filename); 1280 mr_asprintf(command, "cp -f %s %s.pristine", tmp, tmp); 1280 1281 mr_free(tmp); 1281 1282 … … 1334 1335 * the current /dev location 1335 1336 */ 1336 mr_asprintf( &cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);1337 mr_asprintf(cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING); 1337 1338 run_program_and_log_output(cmd, 3); 1338 1339 paranoid_free(cmd); … … 1361 1362 #ifdef __FreeBSD__ 1362 1363 else if (!strcmp(name, "BOOT0")) { 1363 mr_asprintf( &tmp, "boot0cfg -B %s", device);1364 mr_asprintf(tmp, "boot0cfg -B %s", device); 1364 1365 res = run_program_and_log_output(tmp, FALSE); 1365 1366 paranoid_free(tmp); 1366 1367 } else { 1367 mr_asprintf( &tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device);1368 mr_asprintf(tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device); 1368 1369 if (!system(tmp)) { 1369 1370 mr_free(tmp); 1370 mr_asprintf( &tmp, MNT_RESTORING "/sbin/fdisk -B %s", device);1371 mr_asprintf(tmp, MNT_RESTORING "/sbin/fdisk -B %s", device); 1371 1372 res = run_program_and_log_output(tmp, 3); 1372 1373 } else { … … 1452 1453 assert_string_is_neither_NULL_nor_zerolength(bd); 1453 1454 strcpy(editor, find_my_editor()); 1454 mr_asprintf( &boot_device, "%s", bd);1455 mr_asprintf(boot_device, "%s", bd); 1455 1456 1456 1457 if (offer_to_run_stabgrub … … 1469 1470 continue; 1470 1471 } 1471 mr_asprintf( &command, "stabgrub-me %s", p);1472 mr_asprintf(command, "stabgrub-me %s", p); 1472 1473 mr_free(p); 1473 1474 … … 1489 1490 newtSuspend(); 1490 1491 } 1491 mr_asprintf( &tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);1492 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1492 1493 paranoid_system(tmp); 1493 1494 mr_free(tmp); 1494 1495 1495 mr_asprintf( &tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor);1496 mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1496 1497 paranoid_system(tmp); 1497 1498 mr_free(tmp); 1498 1499 1499 mr_asprintf( &tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);1500 mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1500 1501 paranoid_system(tmp); 1501 1502 mr_free(tmp); 1502 1503 1503 mr_asprintf( &tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor);1504 mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1504 1505 paranoid_system(tmp); 1505 1506 mr_free(tmp); … … 1513 1514 if (!run_program_and_log_output("which grub-MR", FALSE)) { 1514 1515 log_msg(1, "Yay! grub-MR found..."); 1515 mr_asprintf( &command, "grub-MR %s /tmp/mountlist.txt", boot_device);1516 mr_asprintf(command, "grub-MR %s /tmp/mountlist.txt", boot_device); 1516 1517 log_msg(1, "command = %s", command); 1517 1518 } else { 1518 mr_asprintf( &command, "chroot " MNT_RESTORING " grub-install %s", boot_device);1519 mr_asprintf(command, "chroot " MNT_RESTORING " grub-install %s", boot_device); 1519 1520 log_msg(1, "WARNING - grub-MR not found; using grub-install"); 1520 1521 } … … 1591 1592 0, 1592 1593 "Modifying fstab and elilo.conf... "); 1593 mr_asprintf( &command, "stabelilo-me");1594 mr_asprintf(command, "stabelilo-me"); 1594 1595 res = run_program_and_log_output(command, 3); 1595 1596 mr_free(command); … … 1602 1603 newtSuspend(); 1603 1604 } 1604 mr_asprintf( &tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);1605 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1605 1606 paranoid_system(tmp); 1606 1607 mr_free(tmp); 1607 1608 1608 mr_asprintf( &tmp, "chroot %s %s /etc/elilo.conf", MNT_RESTORING, editor);1609 mr_asprintf(tmp, "chroot %s %s /etc/elilo.conf", MNT_RESTORING, editor); 1609 1610 paranoid_system(tmp); 1610 1611 mr_free(tmp); … … 1667 1668 0, 1668 1669 "Modifying fstab and lilo.conf, and running LILO... "); 1669 mr_asprintf( &command, "stablilo-me");1670 mr_asprintf(command, "stablilo-me"); 1670 1671 res = run_program_and_log_output(command, 3); 1671 1672 mr_free(command); … … 1678 1679 newtSuspend(); 1679 1680 } 1680 mr_asprintf( &tmp, "%s " MNT_RESTORING "/etc/fstab", editor);1681 mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/fstab", editor); 1681 1682 paranoid_system(tmp); 1682 1683 mr_free(tmp); 1683 1684 1684 mr_asprintf( &tmp, "%s " MNT_RESTORING "/etc/lilo.conf", editor);1685 mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/lilo.conf", editor); 1685 1686 paranoid_system(tmp); 1686 1687 mr_free(tmp); … … 1770 1771 1771 1772 strcpy(editor, find_my_editor()); 1772 mr_asprintf( &boot_device, "%s", bd);1773 mr_asprintf(boot_device, "%s", bd); 1773 1774 1774 1775 if (offer_to_hack_scripts … … 1783 1784 newtSuspend(); 1784 1785 } 1785 mr_asprintf( &tmp, "%s " MNT_RESTORING "/etc/fstab", editor);1786 mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/fstab", editor); 1786 1787 paranoid_system(tmp); 1787 1788 mr_free(tmp); … … 1798 1799 continue; 1799 1800 } 1800 mr_asprintf( &command, "stabraw-me %s", p);1801 mr_asprintf(command, "stabraw-me %s", p); 1801 1802 mr_free(p); 1802 1803 … … 1812 1813 } else { 1813 1814 /* nuke mode */ 1814 mr_asprintf( &command, "raw-MR %s /tmp/mountlist.txt", boot_device);1815 mr_asprintf(command, "raw-MR %s /tmp/mountlist.txt", boot_device); 1815 1816 log_msg(2, "run_raw_mbr() --- command='%s'", command); 1816 1817 … … 1939 1940 for (i = 0; i < 20; i++) { 1940 1941 g_current_progress = i; 1941 mr_asprintf( &tmp, "You have %d seconds left to abort.", 20 - i);1942 mr_asprintf(tmp, "You have %d seconds left to abort.", 20 - i); 1942 1943 update_progress_form(tmp); 1943 1944 mr_free(tmp); … … 1991 1992 paranoid_system("sync"); 1992 1993 1993 mr_asprintf( &tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);1994 mr_asprintf(tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE); 1994 1995 if (run_program_and_log_output(tmp, FALSE)) { 1995 1996 log_msg(1, … … 2010 2011 continue; 2011 2012 } 2012 mr_asprintf( &tmp, "Unmounting device %s ", mountlist->el[lino].device);2013 mr_asprintf(tmp, "Unmounting device %s ", mountlist->el[lino].device); 2013 2014 2014 2015 update_progress_form(tmp); … … 2016 2017 if (is_this_device_mounted(mountlist->el[lino].device)) { 2017 2018 if (!strcmp(mountlist->el[lino].mountpoint, "swap")) { 2018 mr_asprintf( &command, "swapoff %s", mountlist->el[lino].device);2019 mr_asprintf(command, "swapoff %s", mountlist->el[lino].device); 2019 2020 } else { 2020 2021 if (!strcmp(mountlist->el[lino].mountpoint, "/1")) { 2021 mr_asprintf( &command, "umount %s/", MNT_RESTORING);2022 mr_asprintf(command, "umount %s/", MNT_RESTORING); 2022 2023 log_msg(3, 2023 2024 "Well, I know a certain kitty-kitty who'll be sleeping with Mommy tonight..."); 2024 2025 } else { 2025 mr_asprintf( &command, "umount " MNT_RESTORING "%s", mountlist->el[lino].mountpoint);2026 mr_asprintf(command, "umount " MNT_RESTORING "%s", mountlist->el[lino].mountpoint); 2026 2027 2027 2028 /* To support latest Ubuntu where /var is a separate FS … … 2090 2091 } 2091 2092 2092 mr_asprintf( &command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx ./%s ./%s ./%s ./%s ./%s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);2093 mr_asprintf(command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx ./%s ./%s ./%s ./%s ./%s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); 2093 2094 log_msg(2, "command = '%s'", command); 2094 2095 res = run_program_and_log_output(command, -1); … … 2101 2102 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 2102 2103 log_msg(2, "pre-2.2.4 compatible mode on"); 2103 mr_asprintf( &command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);2104 mr_asprintf(command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); 2104 2105 log_msg(2, "command = '%s'", command); 2105 2106 res = run_program_and_log_output(command, -1); … … 2148 2149 log_msg(2, "gcffa --- starting"); 2149 2150 log_to_screen("I'm thinking..."); 2150 mr_asprintf( &mountpt, "%s/mount.bootdisk", bkpinfo->tmpdir);2151 mr_asprintf(mountpt, "%s/mount.bootdisk", bkpinfo->tmpdir); 2151 2152 device[0] = '\0'; 2152 2153 chdir(bkpinfo->tmpdir); 2153 mr_asprintf( &cfg_file, "%s", MONDO_CFG_FILE_STUB);2154 mr_asprintf(cfg_file, "%s", MONDO_CFG_FILE_STUB); 2154 2155 unlink(cfg_file); // cfg_file[] is missing the '/' at the start, FYI, by intent 2155 2156 mr_free(cfg_file); … … 2157 2158 unlink(FILELIST_FULL_STUB); 2158 2159 unlink(BIGGIELIST_TXT_STUB); 2159 mr_asprintf( &command, "mkdir -p %s", mountpt);2160 mr_asprintf(command, "mkdir -p %s", mountpt); 2160 2161 run_program_and_log_output(command, FALSE); 2161 2162 mr_free(command); 2162 2163 2163 mr_asprintf( &cfg_file, "%s/%s", bkpinfo->tmpdir, MONDO_CFG_FILE_STUB);2164 mr_asprintf( &mountlist_file, "%s/%s", bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB);2164 mr_asprintf(cfg_file, "%s/%s", bkpinfo->tmpdir, MONDO_CFG_FILE_STUB); 2165 mr_asprintf(mountlist_file, "%s/%s", bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB); 2165 2166 log_msg(2, "mountpt = %s; cfg_file=%s", mountpt, cfg_file); 2166 2167 mr_free(mountpt); … … 2192 2193 log_msg(2, "media_device is blank; assuming %s"); 2193 2194 } 2194 mr_asprintf( &tmp, "%s", bkpinfo->media_device);2195 mr_asprintf(tmp, "%s", bkpinfo->media_device); 2195 2196 if (extract_cfg_file_and_mountlist_from_tape_dev 2196 2197 (bkpinfo->media_device)) { … … 2231 2232 log_msg(2, 2232 2233 "gcffa --- Plan B, a.k.a. untarring some file from all.tar.gz"); 2233 mr_asprintf( &command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary2234 mr_asprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary 2234 2235 run_program_and_log_output(command, TRUE); 2235 2236 mr_free(command); … … 2238 2239 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 2239 2240 log_msg(2, "pre-2.2.4 compatible mode on"); 2240 mr_asprintf( &command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz %s %s %s %s %s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary2241 mr_asprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz %s %s %s %s %s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary 2241 2242 run_program_and_log_output(command, TRUE); 2242 2243 mr_free(command); … … 2251 2252 if (does_file_exist(MONDO_CFG_FILE_STUB)) { 2252 2253 log_msg(1, "gcffa --- great! We've got the config file"); 2253 mr_asprintf( &tmp, "%s/%s", call_program_and_get_last_line_of_output("pwd"), MONDO_CFG_FILE_STUB);2254 mr_asprintf( &command, "cp -f %s %s", tmp, cfg_file);2254 mr_asprintf(tmp, "%s/%s", call_program_and_get_last_line_of_output("pwd"), MONDO_CFG_FILE_STUB); 2255 mr_asprintf(command, "cp -f %s %s", tmp, cfg_file); 2255 2256 log_it("%s",command); 2256 2257 if (strcmp(tmp, cfg_file) && run_program_and_log_output(command, 1)) { … … 2261 2262 mr_free(command); 2262 2263 2263 mr_asprintf( &command, "cp -f %s/%s %s", call_program_and_get_last_line_of_output("pwd"),2264 mr_asprintf(command, "cp -f %s/%s %s", call_program_and_get_last_line_of_output("pwd"), 2264 2265 MOUNTLIST_FNAME_STUB, mountlist_file); 2265 2266 log_it("%s",command); … … 2271 2272 2272 2273 mr_free(command); 2273 mr_asprintf( &command, "cp -f %s %s", mountlist_file, g_mountlist_fname);2274 mr_asprintf(command, "cp -f %s %s", mountlist_file, g_mountlist_fname); 2274 2275 if (run_program_and_log_output(command, 1)) { 2275 2276 log_msg(1, "Failed to copy mountlist to /tmp"); … … 2277 2278 log_msg(1, "Copied mountlist to /tmp as well OK"); 2278 2279 mr_free(command); 2279 mr_asprintf( &command, "cp -f %s /tmp/",IWANTMYLVM_STUB);2280 mr_asprintf(command, "cp -f %s /tmp/",IWANTMYLVM_STUB); 2280 2281 run_program_and_log_output(command, 1); 2281 2282 } … … 2301 2302 /* Is this code really useful ??? */ 2302 2303 if (extract_mountlist_stub) { 2303 mr_asprintf( &command, "cp -f %s %s/%s", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB);2304 mr_asprintf(command, "cp -f %s %s/%s", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB); 2304 2305 run_program_and_log_output(command, FALSE); 2305 2306 mr_free(command); … … 2307 2308 } 2308 2309 2309 mr_asprintf( &command, "cp -f %s /%s", cfg_file, MONDO_CFG_FILE_STUB);2310 mr_asprintf(command, "cp -f %s /%s", cfg_file, MONDO_CFG_FILE_STUB); 2310 2311 mr_free(cfg_file); 2311 2312 … … 2314 2315 2315 2316 if (extract_mountlist_stub) { 2316 mr_asprintf( &command, "cp -f %s /%s", mountlist_file, MOUNTLIST_FNAME_STUB);2317 mr_asprintf(command, "cp -f %s /%s", mountlist_file, MOUNTLIST_FNAME_STUB); 2317 2318 run_program_and_log_output(command, FALSE); 2318 2319 mr_free(command); … … 2320 2321 mr_free(mountlist_file); 2321 2322 2322 mr_asprintf( &command, "cp -f etc/raidtab /etc/");2323 mr_asprintf(command, "cp -f etc/raidtab /etc/"); 2323 2324 run_program_and_log_output(command, FALSE); 2324 2325 mr_free(command); 2325 2326 2326 2327 if (extract_i_want_my_lvm) { 2327 mr_asprintf( &command, "cp -f %s /tmp/",IWANTMYLVM_STUB);2328 mr_asprintf(command, "cp -f %s /tmp/",IWANTMYLVM_STUB); 2328 2329 run_program_and_log_output(command, FALSE); 2329 2330 mr_free(command); … … 2382 2383 } 2383 2384 log_msg(1,"Sync'ing %s (i=%d)", raidlist->el[i].raid_device, i); 2384 mr_asprintf( &screen_message, "Sync'ing %s", raidlist->el[i].raid_device);2385 mr_asprintf(screen_message, "Sync'ing %s", raidlist->el[i].raid_device); 2385 2386 open_evalcall_form(screen_message); 2386 2387 mr_free(screen_message); -
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2321 r2323 280 280 } 281 281 if (g_ISO_restore_mode) { 282 mr_asprintf( &tmp, "umount %s", bkpinfo->isodir);282 mr_asprintf(tmp, "umount %s", bkpinfo->isodir); 283 283 run_program_and_log_output(tmp, FALSE); 284 284 mr_free(tmp); … … 361 361 362 362 /* Clean up blkid cache file if they exist */ 363 mr_asprintf( &tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path);363 mr_asprintf(tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path); 364 364 (void)unlink(tmp1); 365 365 paranoid_free(tmp1); 366 mr_asprintf( &tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);366 mr_asprintf(tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path); 367 367 (void)unlink(tmp1); 368 368 paranoid_free(tmp1); … … 376 376 377 377 /* Clean up multiconf cache file if they exist */ 378 mr_asprintf( &tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);378 mr_asprintf(tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path); 379 379 (void)unlink(tmp1); 380 380 paranoid_free(tmp1); 381 381 382 382 /* Edit multipath.conf if needed to adapt wwid */ 383 mr_asprintf( &tmp1,"%s/etc/multipath.conf", MNT_RESTORING);383 mr_asprintf(tmp1,"%s/etc/multipath.conf", MNT_RESTORING); 384 384 if (does_file_exist(tmp1)) { 385 385 log_msg(2, "We may need to clean /etc/multipath.conf"); … … 391 391 392 392 if (bkpinfo->restore_mode != nuke) { 393 mr_asprintf( &editor, "%s", find_my_editor());394 mr_asprintf( &tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);393 mr_asprintf(editor, "%s", find_my_editor()); 394 mr_asprintf(tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor); 395 395 popup_and_OK("You will now edit multipath.conf"); 396 396 if (!g_text_mode) { … … 490 490 if (g_text_mode) { 491 491 save_mountlist_to_disk(mountlist, g_mountlist_fname); 492 mr_asprintf( &tmp1, "%s %s", find_my_editor(), g_mountlist_fname);492 mr_asprintf(tmp1, "%s %s", find_my_editor(), g_mountlist_fname); 493 493 res = system(tmp1); 494 494 mr_free(tmp1); … … 663 663 strcpy(fstab_fname, "/tmp/fstab"); 664 664 } 665 mr_asprintf( &tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE);665 mr_asprintf(tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE); 666 666 res = system(tmp1); 667 667 mr_free(tmp1); … … 780 780 assert(raidlist != NULL); 781 781 782 mr_asprintf( &tmpA, "%s", " ");783 mr_asprintf( &tmpB, "%s", " ");784 mr_asprintf( &tmpC, "%s", " ");782 mr_asprintf(tmpA, "%s", " "); 783 mr_asprintf(tmpB, "%s", " "); 784 mr_asprintf(tmpC, "%s", " "); 785 785 786 786 log_msg(2, "nuke_mode --- starting"); … … 803 803 } 804 804 if (!evaluate_mountlist(mountlist, tmpA, tmpB, tmpC)) { 805 mr_asprintf( &tmp, "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", tmpA, tmpB, tmpC);805 mr_asprintf(tmp, "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", tmpA, tmpB, tmpC); 806 806 res = ask_me_yes_or_no(tmp); 807 807 mr_free(tmp); … … 895 895 "Using tune2fs to identify your ext2,3 partitions"); 896 896 897 mr_asprintf( &tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname);897 mr_asprintf(tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname); 898 898 res = run_program_and_log_output(tmp, TRUE); 899 899 mr_free(tmp); … … 915 915 ("Please visit our website at http://www.mondorescue.org for more information."); 916 916 } else { 917 mr_asprintf( &tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information.");917 mr_asprintf(tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information."); 918 918 popup_and_OK(tmp); 919 919 mr_free(tmp); … … 1121 1121 if (!strncmp(biggiestruct.filename, "/dev/", 5)) // Whether NTFS or not :) 1122 1122 { 1123 mr_asprintf( &outfile_fname, "%s", biggiestruct.filename);1123 mr_asprintf(outfile_fname, "%s", biggiestruct.filename); 1124 1124 } else { 1125 mr_asprintf( &outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);1125 mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename); 1126 1126 } 1127 1127 … … 1159 1159 use_ntfsprog_hack = TRUE; 1160 1160 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),1161 mr_asprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768), 1162 1162 (int) (random() % 32768)); 1163 1163 mkfifo(sz_devfile, 0x770); … … 1232 1232 mr_free(mds); 1233 1233 1234 mr_asprintf( &tmp, "Restoring from %s #%d", mds, g_current_media_number);1234 mr_asprintf(tmp, "Restoring from %s #%d", mds, g_current_media_number); 1235 1235 log_to_screen(tmp); 1236 1236 mr_free(tmp); … … 1239 1239 log_to_screen("Continuing to restore."); 1240 1240 } else { 1241 mr_asprintf( &tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, ""));1241 mr_asprintf(tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "")); 1242 1242 if (does_file_exist(tmp) && length_of_file(tmp) == 0) { 1243 1243 log_msg(2, … … 1251 1251 (slice_fname 1252 1252 (bigfileno, sliceno, ARCHIVES_PATH, "lzo"))) { 1253 mr_asprintf( &bzip2_command, "lzop");1253 mr_asprintf(bzip2_command, "lzop"); 1254 1254 strcpy(suffix, "lzo"); 1255 1255 } else … … 1257 1257 (slice_fname 1258 1258 (bigfileno, sliceno, ARCHIVES_PATH, "gz"))) { 1259 mr_asprintf( &bzip2_command, "gzip");1259 mr_asprintf(bzip2_command, "gzip"); 1260 1260 strcpy(suffix, "gz"); 1261 1261 } else … … 1263 1263 (slice_fname 1264 1264 (bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) { 1265 mr_asprintf( &bzip2_command, "bzip2");1265 mr_asprintf(bzip2_command, "bzip2"); 1266 1266 strcpy(suffix, "bz2"); 1267 1267 } else … … 1269 1269 (slice_fname 1270 1270 (bigfileno, sliceno, ARCHIVES_PATH, ""))) { 1271 mr_asprintf( &bzip2_command, "");1271 mr_asprintf(bzip2_command, ""); 1272 1272 strcpy(suffix, ""); 1273 1273 } else { … … 1282 1282 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1283 1283 } else { 1284 mr_asprintf( &bzip2_command, "cat %s 2>> %s",1284 mr_asprintf(bzip2_command, "cat %s 2>> %s", 1285 1285 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1286 1286 } 1287 1287 mds = media_descriptor_string(bkpinfo->backup_media_type); 1288 mr_asprintf( &tmp, "Working on %s #%d, file #%ld, slice #%ld ", mds, g_current_media_number, bigfileno + 1, sliceno);1288 mr_asprintf(tmp, "Working on %s #%d, file #%ld, slice #%ld ", mds, g_current_media_number, bigfileno + 1, sliceno); 1289 1289 mr_free(mds); 1290 1290 log_msg(2, tmp); … … 1321 1321 if (use_ntfsprog_hack) { 1322 1322 log_msg(3, "Waiting for ntfsclone to finish"); 1323 mr_asprintf( &tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");1323 mr_asprintf(tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1324 1324 while (system(tmp) == 0) { 1325 1325 sleep(1); … … 1452 1452 if (use_ntfsprog) { 1453 1453 g_loglevel = 4; 1454 mr_asprintf( &outfile_fname, "%s", orig_bf_fname);1454 mr_asprintf(outfile_fname, "%s", orig_bf_fname); 1455 1455 use_ntfsprog_hack = TRUE; 1456 1456 log_msg(2, "Calling ntfsclone in background because %s is a /dev entry", outfile_fname); 1457 mr_asprintf( &sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));1457 mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768)); 1458 1458 mkfifo(sz_devfile, 0x770); 1459 1459 strcpy(ntfsprog_fifo, sz_devfile); … … 1475 1475 if (!strncmp(orig_bf_fname, "/dev/", 5)) { 1476 1476 // non-NTFS partition 1477 mr_asprintf( &outfile_fname, "%s", orig_bf_fname);1477 mr_asprintf(outfile_fname, "%s", orig_bf_fname); 1478 1478 } else { 1479 1479 // biggiefile 1480 mr_asprintf( &outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname);1480 mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname); 1481 1481 } 1482 1482 use_ntfsprog_hack = FALSE; … … 1492 1492 if (dummy_restore) { 1493 1493 mr_free(outfile_fname); 1494 mr_asprintf( &outfile_fname, "/dev/null");1494 mr_asprintf(outfile_fname, "/dev/null"); 1495 1495 } 1496 1496 1497 1497 if (!bkpinfo->zip_exe[0]) { 1498 mr_asprintf( &command, "cat > \"%s\"", file_to_openout);1498 mr_asprintf(command, "cat > \"%s\"", file_to_openout); 1499 1499 } else { 1500 mr_asprintf( &command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE);1500 mr_asprintf(command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE); 1501 1501 if (strcmp(bkpinfo->zip_exe, "gzip") == 0) { 1502 1502 /* Ignore SIGPIPE for gzip as it causes errors on big files … … 1568 1568 if (use_ntfsprog_hack) { 1569 1569 log_msg(3, "Waiting for ntfsclone to finish"); 1570 mr_asprintf( &tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");1570 mr_asprintf(tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1571 1571 while (system(tmp1) == 0) { 1572 1572 sleep(1); … … 1637 1637 log_msg(5, "Entering"); 1638 1638 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 1639 mr_asprintf( &command, "mkdir -p %s/tmp", MNT_RESTORING);1639 mr_asprintf(command, "mkdir -p %s/tmp", MNT_RESTORING); 1640 1640 run_program_and_log_output(command, 9); 1641 1641 paranoid_free(command); 1642 1642 1643 mr_asprintf( &filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number);1643 mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number); 1644 1644 if (length_of_file(filelist_name) <= 2) { 1645 1645 log_msg(2, "There are _zero_ files in filelist '%s'", filelist_name); … … 1654 1654 log_msg(3, "length_of_file(%s) = %llu", tarball_fname, length_of_file(tarball_fname)); 1655 1655 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);1656 mr_asprintf(tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number); 1657 1657 log_to_screen(tmp); 1658 1658 mr_free(tmp); … … 1663 1663 1664 1664 if (filelist) { 1665 mr_asprintf( &filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number);1665 mr_asprintf(filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number); 1666 1666 if ((matches = 1667 1667 save_filelist_entries_in_common(filelist_name, filelist, … … 1672 1672 log_msg(3, "Saved fileset %ld's subset to %s", current_tarball_number, filelist_subset_fname); 1673 1673 } 1674 mr_asprintf( &screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches);1674 mr_asprintf(screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches); 1675 1675 log_to_screen(screen_message); 1676 1676 mr_free(screen_message); … … 1680 1680 if (filelist == NULL || matches > 0) { 1681 1681 if (g_getfattr) { 1682 mr_asprintf( &xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);1682 mr_asprintf(xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number); 1683 1683 } 1684 1684 if (g_getfacl) { 1685 mr_asprintf( &acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);1685 mr_asprintf(acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number); 1686 1686 } 1687 1687 if (strstr(tarball_fname, ".bz2")) { 1688 mr_asprintf( &executable, "bzip2");1688 mr_asprintf(executable, "bzip2"); 1689 1689 } else if (strstr(tarball_fname, ".gz")) { 1690 mr_asprintf( &executable, "gzip");1690 mr_asprintf(executable, "gzip"); 1691 1691 } else if (strstr(tarball_fname, ".lzo")) { 1692 mr_asprintf( &executable, "lzop");1692 mr_asprintf(executable, "lzop"); 1693 1693 } 1694 1694 if (executable) { 1695 mr_asprintf( &tmp, "which %s > /dev/null 2> /dev/null", executable);1695 mr_asprintf(tmp, "which %s > /dev/null 2> /dev/null", executable); 1696 1696 res = run_program_and_log_output(tmp, FALSE); 1697 1697 mr_free(tmp); … … 1702 1702 } 1703 1703 tmp = executable; 1704 mr_asprintf( &executable, "-P %s -Z", tmp);1704 mr_asprintf(executable, "-P %s -Z", tmp); 1705 1705 mr_free(tmp); 1706 1706 } … … 1712 1712 1713 1713 if (use_star) { 1714 mr_asprintf( &command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname);1714 mr_asprintf(command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname); 1715 1715 if (strstr(tarball_fname, ".bz2")) { 1716 1716 mr_strcat(command, " -bz"); … … 1721 1721 } else { 1722 1722 if (filelist_subset_fname != NULL) { 1723 mr_asprintf( &command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname);1723 mr_asprintf(command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname); 1724 1724 } else { 1725 mr_asprintf( &command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);1725 mr_asprintf(command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname); 1726 1726 } 1727 1727 } … … 1730 1730 1731 1731 #undef BUFSIZE 1732 mr_asprintf( &temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768));1732 mr_asprintf(temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768)); 1733 1733 1734 1734 mr_strcat(command, " 2>> %s >> %s", temp_log, temp_log); … … 1776 1776 } 1777 1777 if (retval) { 1778 mr_asprintf( &command, "cat %s >> %s", temp_log, MONDO_LOGFILE);1778 mr_asprintf(command, "cat %s >> %s", temp_log, MONDO_LOGFILE); 1779 1779 system(command); 1780 1780 paranoid_free(command); … … 1865 1865 * in afio or someting; oh darn.. OK, use tmpfs :-) * 1866 1866 ****************************************************************************/ 1867 mr_asprintf( &afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number);1868 mr_asprintf( &filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number);1869 mr_asprintf( &filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number);1867 mr_asprintf(afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number); 1868 mr_asprintf(filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number); 1869 mr_asprintf(filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number); 1870 1870 1871 1871 res = read_file_from_stream_to_file(afio_fname, size); … … 1877 1877 } 1878 1878 if (bkpinfo->compression_level == 0) { 1879 mr_asprintf( &executable, "%s", "");1879 mr_asprintf(executable, "%s", ""); 1880 1880 } else { 1881 1881 if (bkpinfo->use_star) { 1882 mr_asprintf( &executable, "%s", " -bz");1882 mr_asprintf(executable, "%s", " -bz"); 1883 1883 } else { 1884 mr_asprintf( &executable, "-P %s -Z", bkpinfo->zip_exe);1884 mr_asprintf(executable, "-P %s -Z", bkpinfo->zip_exe); 1885 1885 } 1886 1886 } … … 1893 1893 if (strstr(tarball_fname, ".star.")) { 1894 1894 use_star = TRUE; 1895 mr_asprintf( &command, "star -t file=%s %s", afio_fname, executable);1895 mr_asprintf(command, "star -t file=%s %s", afio_fname, executable); 1896 1896 } else { 1897 1897 use_star = FALSE; 1898 mr_asprintf( &command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname);1898 mr_asprintf(command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname); 1899 1899 } 1900 1900 mr_strcat(command, " > %s 2>> %s", filelist_fname, MONDO_LOGFILE); … … 1927 1927 if (strstr(tarball_fname, ".star.")) { 1928 1928 // star 1929 mr_asprintf( &command, "star -x file=%s %s", afio_fname, executable);1929 mr_asprintf(command, "star -x file=%s %s", afio_fname, executable); 1930 1930 if (filelist) { 1931 1931 mr_strcat(command, " list=%s", filelist_subset_fname); … … 1933 1933 } else { 1934 1934 // afio 1935 mr_asprintf( &command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable);1935 mr_asprintf(command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable); 1936 1936 if (filelist) { 1937 1937 mr_strcat(command, " -w %s", filelist_subset_fname); … … 2026 2026 assert(bkpinfo != NULL); 2027 2027 2028 mr_asprintf( &biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);2028 mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2029 2029 if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) { 2030 2030 log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set); … … 2033 2033 read_cfg_var(g_mondo_cfg_file, "total-slices", tmp); 2034 2034 total_slices = atol(tmp); 2035 mr_asprintf( &tmp1, "Reassembling large files ");2035 mr_asprintf(tmp1, "Reassembling large files "); 2036 2036 mvaddstr_and_log_it(g_currentY, 0, tmp1); 2037 2037 mr_free(tmp1); … … 2066 2066 } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 2067 2067 insist_on_this_cd_number(++g_current_media_number); 2068 mr_asprintf( &tmp1, "Restoring from %s #%d", mds, g_current_media_number);2068 mr_asprintf(tmp1, "Restoring from %s #%d", mds, g_current_media_number); 2069 2069 log_to_screen(tmp1); 2070 2070 mr_free(tmp1); … … 2081 2081 } else { 2082 2082 just_changed_cds = FALSE; 2083 mr_asprintf( &tmp1, "Restoring big file %ld", bigfileno + 1);2083 mr_asprintf(tmp1, "Restoring big file %ld", bigfileno + 1); 2084 2084 update_progress_form(tmp1); 2085 2085 mr_free(tmp1); … … 2098 2098 fclose(fbw); 2099 2099 if (g_getfattr) { 2100 mr_asprintf( &xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);2100 mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2101 2101 if (length_of_file(xattr_fname) > 0) { 2102 2102 set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname); … … 2105 2105 } 2106 2106 if (g_getfacl) { 2107 mr_asprintf( &acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);2107 mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2108 2108 if (length_of_file(acl_fname) > 0) { 2109 2109 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); … … 2177 2177 2178 2178 mds = media_descriptor_string(bkpinfo->backup_media_type); 2179 mr_asprintf( &progress_str, "Restoring from %s #%d", mds, g_current_media_number);2179 mr_asprintf(progress_str, "Restoring from %s #%d", mds, g_current_media_number); 2180 2180 2181 2181 log_to_screen(progress_str); … … 2189 2189 mr_free(progress_str); 2190 2190 2191 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number);2191 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number); 2192 2192 if (!does_file_exist(tarball_fname)) { 2193 2193 mr_free(tarball_fname); 2194 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number);2194 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number); 2195 2195 } 2196 2196 if (!does_file_exist(tarball_fname)) { 2197 2197 mr_free(tarball_fname); 2198 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number);2198 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number); 2199 2199 } 2200 2200 if (!does_file_exist(tarball_fname)) { 2201 2201 mr_free(tarball_fname); 2202 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number);2202 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number); 2203 2203 } 2204 2204 if (!does_file_exist(tarball_fname)) { 2205 2205 mr_free(tarball_fname); 2206 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number);2206 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number); 2207 2207 } 2208 2208 if (!does_file_exist(tarball_fname)) { 2209 2209 mr_free(tarball_fname); 2210 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number);2210 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number); 2211 2211 } 2212 2212 if (!does_file_exist(tarball_fname)) { … … 2224 2224 } 2225 2225 g_current_media_number++; 2226 mr_asprintf( &progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number);2226 mr_asprintf(progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number); 2227 2227 log_to_screen(progress_str); 2228 2228 } else { 2229 mr_asprintf( &progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number);2229 mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number); 2230 2230 for (res = 999, attempts = 0; attempts < 3 && res != 0; 2231 2231 attempts++) { … … 2235 2235 filelist); 2236 2236 } 2237 mr_asprintf( &tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number);2237 mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number); 2238 2238 if (res) { 2239 2239 mr_strcat(tmp1, "reported errors"); … … 2319 2319 total_slices = atol(tmp); 2320 2320 if (g_getfattr) { 2321 mr_asprintf( &xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2321 mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2322 2322 } 2323 2323 if (g_getfacl) { 2324 mr_asprintf( &acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2325 } 2326 mr_asprintf( &tmp1, "Reassembling large files ");2324 mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2325 } 2326 mr_asprintf(tmp1, "Reassembling large files "); 2327 2327 mvaddstr_and_log_it(g_currentY, 0, tmp1); 2328 2328 mr_free(tmp1); 2329 2329 2330 mr_asprintf( &biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);2330 mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2331 2331 if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) { 2332 2332 log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set); … … 2364 2364 p++; 2365 2365 } 2366 mr_asprintf( &tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024);2366 mr_asprintf(tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024); 2367 2367 update_progress_form(tmp1); 2368 2368 mr_free(tmp1); … … 2479 2479 run_program_and_log_output("pwd", 5); 2480 2480 2481 mr_asprintf( &progress_str, "Restoring from media #%d", g_current_media_number);2481 mr_asprintf(progress_str, "Restoring from media #%d", g_current_media_number); 2482 2482 log_to_screen(progress_str); 2483 2483 open_progress_form("Restoring from archives", … … 2501 2501 update_progress_form(progress_str); 2502 2502 if (g_getfattr) { 2503 mr_asprintf( &xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);2503 mr_asprintf(xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number); 2504 2504 unlink(xattr_fname); 2505 2505 } 2506 2506 if (g_getfacl) { 2507 mr_asprintf( &acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);2507 mr_asprintf(acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number); 2508 2508 unlink(acl_fname); 2509 2509 } … … 2519 2519 retval += res; 2520 2520 if (res) { 2521 mr_asprintf( &tmp, "Fileset %ld - errors occurred", current_afioball_number);2521 mr_asprintf(tmp, "Fileset %ld - errors occurred", current_afioball_number); 2522 2522 log_to_screen(tmp); 2523 2523 mr_free(tmp); … … 2534 2534 2535 2535 mr_free(progress_str); 2536 mr_asprintf( &progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number);2536 mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number); 2537 2537 mr_free(mds); 2538 2538 res = read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr); … … 2594 2594 g_current_media_number = 1; 2595 2595 getcwd(cwd, MAX_STR_LEN - 1); 2596 mr_asprintf( &tmp, "mkdir -p %s", bkpinfo->restore_path);2596 mr_asprintf(tmp, "mkdir -p %s", bkpinfo->restore_path); 2597 2597 run_program_and_log_output(tmp, FALSE); 2598 2598 mr_free(tmp); … … 2666 2666 { 2667 2667 log_msg(0, "-------------- Mondo Restore v%s -------------", PACKAGE_VERSION); 2668 log_msg(0, 2669 "DON'T PANIC! Mondorestore logs almost everything, so please "); 2670 log_msg(0, 2671 "don't break out in a cold sweat just because you see a few "); 2672 log_msg(0, 2673 "error messages in the log. Read them; analyze them; see if "); 2674 log_msg(0, 2675 "they are significant; above all, verify your backups! Please"); 2676 log_msg(0, 2677 "attach a compressed copy of this log to any e-mail you send "); 2678 log_msg(0, 2679 "to the Mondo mailing list when you are seeking technical "); 2680 log_msg(0, 2681 "support. Without it, we can't help you. - DevTeam"); 2682 log_msg(0, 2683 "------------------------------------------------------------"); 2684 log_msg(0, 2685 "BTW, despite (or perhaps because of) the wealth of messages,"); 2686 log_msg(0, 2687 "some users are inclined to stop reading this log. If Mondo "); 2688 log_msg(0, 2689 "stopped for some reason, chances are it's detailed here. "); 2690 log_msg(0, 2691 "More than likely there's a message at the very end of this "); 2692 log_msg(0, 2693 "log that will tell you what is wrong. Please read it! "); 2694 log_msg(0, 2695 "------------------------------------------------------------"); 2668 log_msg(0, "DON'T PANIC! Mondorestore logs almost everything, so please "); 2669 log_msg(0, "don't break out in a cold sweat just because you see a few "); 2670 log_msg(0, "error messages in the log. Read them; analyze them; see if "); 2671 log_msg(0, "they are significant; above all, verify your backups! Please"); 2672 log_msg(0, "attach a compressed copy of this log to any e-mail you send "); 2673 log_msg(0, "to the Mondo mailing list when you are seeking technical "); 2674 log_msg(0, "support. Without it, we can't help you. - DevTeam"); 2675 log_msg(0, "------------------------------------------------------------"); 2676 log_msg(0, "BTW, despite (or perhaps because of) the wealth of messages,"); 2677 log_msg(0, "some users are inclined to stop reading this log. If Mondo "); 2678 log_msg(0, "stopped for some reason, chances are it's detailed here. "); 2679 log_msg(0, "More than likely there's a message at the very end of this "); 2680 log_msg(0, "log that will tell you what is wrong. Please read it! "); 2681 log_msg(0, "------------------------------------------------------------"); 2696 2682 } 2697 2683 … … 2768 2754 2769 2755 /* Backup original mountlist.txt */ 2770 mr_asprintf( &tmp, "%s.orig", g_mountlist_fname);2756 mr_asprintf(tmp, "%s.orig", g_mountlist_fname); 2771 2757 if (!does_file_exist(g_mountlist_fname)) { 2772 2758 log_msg(2, "%ld: Warning - g_mountlist_fname (%s) does not exist yet", __LINE__, g_mountlist_fname); 2773 2759 } else if (!does_file_exist(tmp)) { 2774 2760 mr_free(tmp); 2775 mr_asprintf( &tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname);2761 mr_asprintf(tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname); 2776 2762 run_program_and_log_output(tmp, FALSE); 2777 2763 } … … 2948 2934 log_msg(2, "Still here. Yay."); 2949 2935 if ((strlen(bkpinfo->tmpdir) > 0) && (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL)) { 2950 mr_asprintf( &tmp, "rm -Rf %s/*", bkpinfo->tmpdir);2936 mr_asprintf(tmp, "rm -Rf %s/*", bkpinfo->tmpdir); 2951 2937 run_program_and_log_output(tmp, FALSE); 2952 2938 mr_free(tmp); … … 2971 2957 && !is_this_device_mounted(bkpinfo->nfs_mount)) { 2972 2958 log_msg(1, "Mounting nfs dir"); 2973 sprintf(bkpinfo->isodir, "/tmp/isodir"); 2959 mr_free(bkpinfo->isodir); 2960 mr_asprintf(tmp, "/tmp/isodir"); 2961 bkpinfo->isodir = tmp; 2974 2962 run_program_and_log_output("mkdir -p /tmp/isodir", 5); 2975 mr_asprintf( &tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount);2963 mr_asprintf(tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount); 2976 2964 run_program_and_log_output(tmp, 1); 2977 2965 mr_free(tmp); … … 3070 3058 } else { 3071 3059 log_msg(1, "Re-mounted partitions for post-nuke stuff"); 3072 mr_asprintf( &tmp, "post-nuke %s %d", bkpinfo->restore_path, retval);3060 mr_asprintf(tmp, "post-nuke %s %d", bkpinfo->restore_path, retval); 3073 3061 log_msg(2, "Calling '%s'", tmp); 3074 3062 if ((res = run_program_and_log_output(tmp, 0))) { … … 3091 3079 set_signals(FALSE); 3092 3080 log_to_screen("Restore log (%s) copied to /var/log on your hard disk", MONDO_LOGFILE); 3093 mr_asprintf( &tmp, "Mondo-restore is exiting (retval=%d) ", retval);3081 mr_asprintf(tmp, "Mondo-restore is exiting (retval=%d) ", retval); 3094 3082 log_to_screen(tmp); 3095 3083 mr_free(tmp); 3096 3084 3097 mr_asprintf( &tmp, "umount %s", bkpinfo->isodir);3085 mr_asprintf(tmp, "umount %s", bkpinfo->isodir); 3098 3086 run_program_and_log_output(tmp, 5); 3099 3087 mr_free(tmp); … … 3105 3093 } // for b0rken distros 3106 3094 if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) { 3107 mr_asprintf( &tmp, "rm -Rf %s", bkpinfo->tmpdir);3095 mr_asprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir); 3108 3096 system(tmp); 3109 3097 mr_free(tmp); -
branches/2.2.10/mondo/test/test-mountlist.c
r2320 r2323 55 55 bool ret = FALSE; 56 56 57 mr_asprintf( &MONDO_LOGFILE,"/tmp/mrtest-mountlist.log");57 mr_asprintf(MONDO_LOGFILE,"/tmp/mrtest-mountlist.log"); 58 58 59 59 /* Globals */ … … 71 71 72 72 setup_newt_stuff(); 73 mr_asprintf( &g_mountlist_fname, "/tmp/mountlist.txt");73 mr_asprintf(g_mountlist_fname, "/tmp/mountlist.txt"); 74 74 log_it("before mountlist"); 75 75 load_mountlist(mountlist, g_mountlist_fname); … … 82 82 log_it("after edit_mountlist"); 83 83 84 mr_asprintf( &tmpA, "%s", " ");85 mr_asprintf( &tmpB, "%s", " ");86 mr_asprintf( &tmpC, "%s", " ");84 mr_asprintf(tmpA, "%s", " "); 85 mr_asprintf(tmpB, "%s", " "); 86 mr_asprintf(tmpC, "%s", " "); 87 87 ret = evaluate_mountlist(mountlist, tmpA, tmpB, tmpC); 88 88 log_it("after evaluate_mountlist"); -
branches/2.2.10/mondo/test/test-truncname.c
r2320 r2323 66 66 int i; 67 67 68 mr_asprintf( &MONDO_LOGFILE,"/tmp/mrtest-truncname.log");68 mr_asprintf(MONDO_LOGFILE,"/tmp/mrtest-truncname.log"); 69 69 70 70 /* Globals */ … … 76 76 for (i=0; list[i] != NULL; i++) { 77 77 log_it("%d: partition %s ...",i, list[i]); 78 mr_asprintf( &part,"%s",list[i]);78 mr_asprintf(part,"%s",list[i]); 79 79 disk = truncate_to_drive_name(part); 80 80 log_it("...belongs to disk %s",disk);
Note:
See TracChangeset
for help on using the changeset viewer.