Changeset 3185 in MondoRescue
- Timestamp:
- Sep 20, 2013, 2:29:57 PM (11 years ago)
- Location:
- branches/3.0/mondo
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/common/libmondo-archive.c
r3150 r3185 200 200 201 201 if (!does_file_exist(filelist)) { 202 mr_asprintf( &tmp, "(archive_this_fileset) - filelist %s does not exist", filelist);202 mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", filelist); 203 203 log_to_screen(tmp); 204 204 paranoid_free(tmp); … … 206 206 } 207 207 208 mr_asprintf( &tmp, "echo hi > %s 2> /dev/null", fname);208 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname); 209 209 if (system(tmp)) { 210 210 paranoid_free(tmp); … … 213 213 paranoid_free(tmp); 214 214 215 mr_asprintf( &command, "star H=exustar list=%s -c -sparse " STAR_ACL_SZ " file=%s",215 mr_asprintf(command, "star H=exustar list=%s -c -sparse " STAR_ACL_SZ " file=%s", 216 216 filelist, fname); 217 217 if (bkpinfo->use_lzo) { … … 227 227 log_msg(5, "command='%s'", command); 228 228 res = system(command); 229 mr_asprintf( &tmp, "%s", last_line_of_file(MONDO_LOGFILE));229 mr_asprintf(tmp, "%s", last_line_of_file(MONDO_LOGFILE)); 230 230 log_msg(1, "res=%d; tmp='%s'", res, tmp); 231 231 if (bkpinfo->use_star && (res == 254 || res == 65024) … … 307 307 308 308 if (!does_file_exist(filelist)) { 309 mr_asprintf( &tmp, "(archive_this_fileset) - filelist %s does not exist",309 mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", 310 310 filelist); 311 311 log_to_screen(tmp); … … 313 313 return (1); 314 314 } 315 mr_asprintf( &tmp, "echo hi > %s 2> /dev/null", fname);315 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname); 316 316 if (system(tmp)) { 317 317 paranoid_free(tmp); … … 322 322 323 323 if (bkpinfo->compression_level > 0) { 324 mr_asprintf( &tmp, "%s/do-not-compress-these", g_mondo_home);324 mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home); 325 325 // -b %ld, TAPE_BLOCK_SIZE 326 mr_asprintf( &zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe,326 mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe, 327 327 bkpinfo->compression_level); 328 328 if (does_file_exist(tmp)) { … … 333 333 paranoid_free(tmp); 334 334 } else { 335 mr_asprintf( &zipparams, "");335 mr_asprintf(zipparams, ""); 336 336 } 337 337 … … 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",353 mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", 354 354 TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE); 355 355 paranoid_free(zipparams); 356 356 357 mr_asprintf( &tmp, "echo hi > %s 2> /dev/null", fname);357 mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname); 358 358 if (system(tmp)) { 359 359 paranoid_free(tmp); … … 545 545 "Calling MINDI to create boot+data disks"); 546 546 open_evalcall_form("Calling MINDI to create boot+data disks"); 547 mr_asprintf( &tmp, "%s/filelist.full", bkpinfo->tmpdir);547 mr_asprintf(tmp, "%s/filelist.full", bkpinfo->tmpdir); 548 548 if (!does_file_exist(tmp)) { 549 549 mr_free(tmp); 550 mr_asprintf( &tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);550 mr_asprintf(tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir); 551 551 if (!does_file_exist(tmp)) { 552 552 fatal_error … … 557 557 mr_free(tmp); 558 558 559 mr_asprintf( &tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);560 mr_asprintf( &last_filelist_number, "%s", last_line_of_file(tmp));559 mr_asprintf(tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir); 560 mr_asprintf(last_filelist_number, "%s", last_line_of_file(tmp)); 561 561 mr_free(tmp); 562 562 563 563 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 564 mr_asprintf( &tape_size_sz, "%ld", bkpinfo->media_size);564 mr_asprintf(tape_size_sz, "%ld", bkpinfo->media_size); 565 565 ntapedev = get_non_rewind_dev(bkpinfo->media_device); 566 566 if ((bkpinfo->use_obdr) && (ntapedev != NULL)) { … … 572 572 } 573 573 paranoid_free(ntapedev); 574 mr_asprintf( &tape_device, "%s", bkpinfo->media_device);574 mr_asprintf(tape_device, "%s", bkpinfo->media_device); 575 575 } else { 576 mr_asprintf( &tape_size_sz, "%ld", 0L);;577 mr_asprintf( &tape_device, "");576 mr_asprintf(tape_size_sz, "%ld", 0L);; 577 mr_asprintf(tape_device, ""); 578 578 } 579 579 if (bkpinfo->use_lzo) { 580 mr_asprintf( &use_lzo_sz, "yes");580 mr_asprintf(use_lzo_sz, "yes"); 581 581 } else { 582 mr_asprintf( &use_lzo_sz, "no");582 mr_asprintf(use_lzo_sz, "no"); 583 583 } 584 584 if (bkpinfo->use_gzip) { 585 mr_asprintf( &use_gzip_sz, "yes");585 mr_asprintf(use_gzip_sz, "yes"); 586 586 } else { 587 mr_asprintf( &use_gzip_sz, "no");587 mr_asprintf(use_gzip_sz, "no"); 588 588 } 589 589 if (bkpinfo->use_star) { 590 mr_asprintf( &use_star_sz, "yes");590 mr_asprintf(use_star_sz, "yes"); 591 591 } else { 592 mr_asprintf( &use_star_sz, "no");592 mr_asprintf(use_star_sz, "no"); 593 593 } 594 594 595 595 if (bkpinfo->compression_level > 0) { 596 mr_asprintf( &use_comp_sz, "yes");596 mr_asprintf(use_comp_sz, "yes"); 597 597 } else { 598 mr_asprintf( &use_comp_sz, "no");599 } 600 601 mr_asprintf( &broken_bios_sz, "yes"); /* assume so */598 mr_asprintf(use_comp_sz, "no"); 599 } 600 601 mr_asprintf(broken_bios_sz, "yes"); /* assume so */ 602 602 if (g_cd_recovery) { 603 mr_asprintf( &cd_recovery_sz, "yes");603 mr_asprintf(cd_recovery_sz, "yes"); 604 604 } else { 605 mr_asprintf( &cd_recovery_sz, "no");605 mr_asprintf(cd_recovery_sz, "no"); 606 606 } 607 607 if (bkpinfo->make_cd_use_lilo) { 608 mr_asprintf( &use_lilo_sz, "yes");608 mr_asprintf(use_lilo_sz, "yes"); 609 609 } else { 610 mr_asprintf( &use_lilo_sz, "no");610 mr_asprintf(use_lilo_sz, "no"); 611 611 } 612 612 … … 617 617 618 618 #ifdef __FreeBSD__ 619 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output619 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 620 620 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 621 621 if (!bootdev[0]) { 622 622 mr_free(bootdev); 623 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output623 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 624 624 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'")); 625 625 } … … 627 627 /* Linux */ 628 628 #ifdef __IA64__ 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 ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 631 631 #else 632 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output632 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 633 633 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 634 634 #endif … … 636 636 mr_free(bootdev); 637 637 #ifdef __IA64__ 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/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 640 640 #else 641 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output641 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 642 642 ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 643 643 #endif … … 645 645 if (!bootdev[0]) { 646 646 mr_free(bootdev); 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 ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'")); 649 649 if (strstr(bootdev, "/dev/cciss/")) { 650 650 mr_free(bootdev); 651 mr_asprintf( &bootdev, "%s", call_program_and_get_last_line_of_output651 mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output 652 652 ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1")); 653 653 } … … 660 660 ch = 'U'; 661 661 if (bkpinfo->boot_loader != '\0') { 662 mr_asprintf( &tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);662 mr_asprintf(tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader); 663 663 log_msg(2, tmp); 664 664 mr_free(tmp); … … 667 667 } 668 668 if (bkpinfo->boot_device[0] != '\0') { 669 mr_asprintf( &tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);669 mr_asprintf(tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device); 670 670 log_msg(2, tmp); 671 671 mr_free(tmp); … … 690 690 } 691 691 if (bkpinfo->boot_loader == 'L') { 692 mr_asprintf( &bootldr_str, "LILO");692 mr_asprintf(bootldr_str, "LILO"); 693 693 if (!does_file_exist("/etc/lilo.conf")) { 694 694 fatal_error … … 696 696 } 697 697 } else if (bkpinfo->boot_loader == 'G') { 698 mr_asprintf( &bootldr_str, "GRUB");698 mr_asprintf(bootldr_str, "GRUB"); 699 699 if (!does_file_exist("/boot/grub/menu.lst") 700 700 && does_file_exist("/boot/grub/grub.conf")) { … … 706 706 ("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg but I cannot find it there. What is wrong with your Linux distribution?"); 707 707 } 708 mr_asprintf( &bootldr_ver, "%s", call_program_and_get_last_line_of_output("grub --version"));708 mr_asprintf(bootldr_ver, "%s", call_program_and_get_last_line_of_output("grub --version")); 709 709 } else if (bkpinfo->boot_loader == 'E') { 710 mr_asprintf( &bootldr_str, "ELILO");710 mr_asprintf(bootldr_str, "ELILO"); 711 711 /* BCO: fix it for Debian, Mandrake, ... */ 712 712 if (!does_file_exist("/etc/elilo.conf") … … 739 739 } 740 740 } else if (bkpinfo->boot_loader == 'R') { 741 mr_asprintf( &bootldr_str, "RAW");741 mr_asprintf(bootldr_str, "RAW"); 742 742 } 743 743 #ifdef __FreeBSD__ 744 744 else if (bkpinfo->boot_loader == 'D') { 745 mr_asprintf( &bootldr_str, "DD");745 mr_asprintf(bootldr_str, "DD"); 746 746 } 747 747 748 748 else if (bkpinfo->boot_loader == 'B') { 749 mr_asprintf( &bootldr_str, "BOOT0");749 mr_asprintf(bootldr_str, "BOOT0"); 750 750 } 751 751 #endif 752 752 else { 753 mr_asprintf( &bootldr_str, "unknown");754 } 755 mr_asprintf( &tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);753 mr_asprintf(bootldr_str, "unknown"); 754 } 755 mr_asprintf(tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device); 756 756 log_to_screen(tmp); 757 757 mr_free(tmp); 758 758 if (bootldr_ver != NULL) { 759 mr_asprintf( &tmp, "Boot loader version string: %s", bootldr_ver);759 mr_asprintf(tmp, "Boot loader version string: %s", bootldr_ver); 760 760 log_to_screen(tmp); 761 761 mr_free(tmp); 762 762 } 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 netfs: 790 mr_asprintf( &value, "netfs");790 mr_asprintf(value, "netfs"); 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/BOOTLOADER.VER", bkpinfo->tmpdir);825 mr_asprintf(tmp, "%s/BOOTLOADER.VER", bkpinfo->tmpdir); 826 826 if (write_one_liner_data_file(tmp, bootldr_ver)) { 827 827 res++; … … 832 832 mr_free(tmp); 833 833 834 mr_asprintf( &tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);834 mr_asprintf(tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir); 835 835 if (bkpinfo->differential) { 836 836 res += write_one_liner_data_file(tmp, "1"); … … 841 841 842 842 if (g_getfattr) { 843 mr_asprintf( &tmp1, "%s/XATTR", bkpinfo->tmpdir);843 mr_asprintf(tmp1, "%s/XATTR", bkpinfo->tmpdir); 844 844 if (write_one_liner_data_file(tmp1, "TRUE")) { 845 845 log_msg(1, "%ld: Unable to write one-liner XATTR", … … 849 849 } 850 850 if (g_getfacl) { 851 mr_asprintf( &tmp1, "%s/ACL", bkpinfo->tmpdir);851 mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir); 852 852 if (write_one_liner_data_file(tmp1, "TRUE")) { 853 853 log_msg(1, "%ld: Unable to write one-liner ACL", … … 857 857 } 858 858 if (bkpinfo->use_obdr) { 859 mr_asprintf( &tmp1, "%s/OBDR", bkpinfo->tmpdir);859 mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir); 860 860 if (write_one_liner_data_file(tmp1, "TRUE")) { 861 861 log_msg(1, "%ld: Unable to write one-liner OBDR", … … 868 868 size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1; 869 869 /* add netfs stuff here? */ 870 mr_asprintf( &command, "mkdir -p %s/images", bkpinfo->scratchdir);870 mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir); 871 871 if (system(command)) { 872 872 res++; … … 880 880 6=\"%s\" 7=%ld 8=\"%s\" 9=\"%s\" 10=\"%s\" \ 881 881 11=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/ 882 mr_asprintf( &command, "mindi %s --custom %s %s/images '%s' '%s' \882 mr_asprintf(command, "mindi %s --custom %s %s/images '%s' '%s' \ 883 883 '%s' %ld '%s' '%s' '%s' \ 884 884 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'", tmp2, bkpinfo->tmpdir, // parameter #2 … … 929 929 if (!res) { 930 930 log_to_screen("Boot+data disks were created OK"); 931 mr_asprintf( &command, "cp -f %s/images/mindi.iso %s/mondorescue.iso",931 mr_asprintf(command, "cp -f %s/images/mindi.iso %s/mondorescue.iso", 932 932 bkpinfo->scratchdir, MINDI_CACHE); 933 933 log_msg(2, command); … … 936 936 937 937 if (bkpinfo->nonbootable_backup) { 938 mr_asprintf( &command, "cp -f %s/all.tar.gz %s/images",938 mr_asprintf(command, "cp -f %s/all.tar.gz %s/images", 939 939 bkpinfo->tmpdir, bkpinfo->scratchdir); 940 940 if (system(command)) { … … 946 946 /* For USB we already have everything on the key */ 947 947 if (bkpinfo->backup_media_type == usb) { 948 mr_asprintf( &command, "rm -rf %s/images", bkpinfo->scratchdir);948 mr_asprintf(command, "rm -rf %s/images", bkpinfo->scratchdir); 949 949 run_program_and_log_output(command, FALSE); 950 950 paranoid_free(command); 951 951 } else { 952 mr_asprintf( &tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir,952 mr_asprintf(tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, 953 953 bkpinfo->tmpdir); 954 954 if (system(tmp)) { … … 964 964 } else { 965 965 log_to_screen("Mindi failed to create your boot+data disks."); 966 mr_asprintf( &command, "grep 'Fatal error' /var/log/mindi.log");967 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));966 mr_asprintf(command, "grep 'Fatal error' /var/log/mindi.log"); 967 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 968 968 paranoid_free(command); 969 969 … … 1470 1470 sleep(5); 1471 1471 } 1472 mr_asprintf( &media_usage_comment, "%s", percent_media_full_comment());1472 mr_asprintf(media_usage_comment, "%s", percent_media_full_comment()); 1473 1473 /* copy to CD (scratchdir) ... and an actual CD-R if necessary */ 1474 1474 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { … … 1513 1513 mr_free(media_usage_comment); 1514 1514 if (res) { 1515 mr_asprintf( &tmp, "Failed to add archive %ld's files to CD dir\n",1515 mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", 1516 1516 storing_set_no); 1517 1517 log_to_screen(tmp); … … 1526 1526 close_progress_form(); 1527 1527 1528 mr_asprintf( &tmp, "Your regular files have been archived ");1528 mr_asprintf(tmp, "Your regular files have been archived "); 1529 1529 log_msg(2, "Joining background threads to foreground thread"); 1530 1530 for (i = 0; i < noof_threads; i++) { … … 1596 1596 log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir); 1597 1597 tmp1 = getcwd(old_pwd, MAX_STR_LEN - 1); 1598 mr_asprintf( &tmp, "chmod 700 %s", bkpinfo->scratchdir);1598 mr_asprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir); 1599 1599 run_program_and_log_output(tmp, FALSE); 1600 1600 paranoid_free(tmp); … … 1604 1604 1605 1605 mds = media_descriptor_string(bkpinfo->backup_media_type); 1606 mr_asprintf( &message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number);1606 mr_asprintf(message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number); 1607 1607 mr_free(mds); 1608 1608 log_msg(1, message_to_screen); 1609 1609 1610 mr_asprintf( &tmp1, "%s1", bkpinfo->media_device);1610 mr_asprintf(tmp1, "%s1", bkpinfo->media_device); 1611 1611 if (is_this_device_mounted(tmp1)) { 1612 1612 log_msg(1, "USB device mounted. Remounting it at the right place"); 1613 mr_asprintf( &tmp, "umount %s", tmp1);1613 mr_asprintf(tmp, "umount %s", tmp1); 1614 1614 run_program_and_log_output(tmp, FALSE); 1615 1615 paranoid_free(tmp); … … 1618 1618 1619 1619 log_msg(1, "Mounting USB device."); 1620 mr_asprintf( &tmp1, "%s/usb", bkpinfo->tmpdir);1621 mr_asprintf( &tmp, "mkdir -p %s", tmp1);1620 mr_asprintf(tmp1, "%s/usb", bkpinfo->tmpdir); 1621 mr_asprintf(tmp, "mkdir -p %s", tmp1); 1622 1622 run_program_and_log_output(tmp, FALSE); 1623 1623 paranoid_free(tmp); 1624 1624 1625 1625 /* Mindi always create one single parition on the USB dev */ 1626 mr_asprintf( &tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);1626 mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, tmp1); 1627 1627 run_program_and_log_output(tmp, FALSE); 1628 1628 paranoid_free(tmp); … … 1634 1634 1635 1635 /* Command to execute */ 1636 mr_asprintf( &tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1);1636 mr_asprintf(tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1); 1637 1637 res = eval_call_to_make_USB(tmp, message_to_screen); 1638 1638 if (res) { 1639 mr_asprintf( &result_sz, "%s ...failed",tmp);1639 mr_asprintf(result_sz, "%s ...failed",tmp); 1640 1640 } else { 1641 mr_asprintf( &result_sz, "%s ...OK",tmp);1641 mr_asprintf(result_sz, "%s ...OK",tmp); 1642 1642 } 1643 1643 log_to_screen(result_sz); … … 1647 1647 1648 1648 /* Recreate the required structure under the scratch dir */ 1649 mr_asprintf( &tmp,"mkdir %s/archive", bkpinfo->scratchdir);1649 mr_asprintf(tmp,"mkdir %s/archive", bkpinfo->scratchdir); 1650 1650 run_program_and_log_output(tmp, FALSE); 1651 1651 paranoid_free(tmp); … … 1655 1655 1656 1656 if (is_this_device_mounted(bkpinfo->media_device)) { 1657 mr_asprintf( &tmp, "umount %s1", bkpinfo->media_device);1657 mr_asprintf(tmp, "umount %s1", bkpinfo->media_device); 1658 1658 run_program_and_log_output(tmp, FALSE); 1659 1659 paranoid_free(tmp); … … 1744 1744 1745 1745 if (bkpinfo->call_before_iso[0] != '\0') { 1746 mr_asprintf( &message_to_screen, "Running pre-ISO call for CD#%d",1746 mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d", 1747 1747 g_current_media_number); 1748 1748 res = … … 1765 1765 sprintf(tmp, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir); 1766 1766 mds = media_descriptor_string(bkpinfo->backup_media_type); 1767 mr_asprintf( &message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number);1767 mr_asprintf(message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number); 1768 1768 mr_free(mds); 1769 1769 … … 1810 1810 } 1811 1811 pause_for_N_seconds(5, "Letting DVD drive settle"); 1812 mr_asprintf( &sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);1812 mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device); 1813 1813 log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk); 1814 1814 res = … … 1864 1864 } else { 1865 1865 mds = media_descriptor_string(bkpinfo->backup_media_type); 1866 mr_asprintf( &message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number);1866 mr_asprintf(message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number); 1867 1867 log_msg(1, message_to_screen); 1868 mr_asprintf( &result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds, g_current_media_number);1868 mr_asprintf(result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds, g_current_media_number); 1869 1869 mr_free(mds); 1870 1870 if (find_home_of_exe("genisoimage")) { 1871 mr_asprintf( &isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD);1871 mr_asprintf(isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD); 1872 1872 } else { 1873 mr_asprintf( &isofs_cmd, "%s", MONDO_MKISOFS_CMD);1873 mr_asprintf(isofs_cmd, "%s", MONDO_MKISOFS_CMD); 1874 1874 } 1875 1875 if (bkpinfo->nonbootable_backup) { 1876 1876 log_msg(1, "Making nonbootable backup"); 1877 mr_asprintf( &full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS);1877 mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS); 1878 1878 res = eval_call_to_make_ISO(full_isofs_cmd, 1879 1879 destfile, g_current_media_number, … … 1894 1894 #ifdef __IA64__ 1895 1895 log_msg(1, "IA64 --> elilo"); 1896 mr_asprintf( &full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_ELILO);1896 mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_ELILO); 1897 1897 res = eval_call_to_make_ISO(full_isofs_cmd, 1898 1898 destfile, … … 1903 1903 #else 1904 1904 log_msg(1, "Non-ia64 --> lilo"); 1905 mr_asprintf( &full_isofs_cmd, "%s%s-b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -V _CD#_ .",isofs_cmd,MONDO_MKISOFS);1905 mr_asprintf(full_isofs_cmd, "%s%s-b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -V _CD#_ .",isofs_cmd,MONDO_MKISOFS); 1906 1906 res = 1907 1907 // FIXME: fixed boot size probably wrong. lilo to be removed … … 1915 1915 log_msg(1, "make_cd_use_lilo = FALSE"); 1916 1916 log_msg(1, "Isolinux"); 1917 mr_asprintf( &full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_SYSLINUX);1917 mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_SYSLINUX); 1918 1918 res = 1919 1919 eval_call_to_make_ISO(full_isofs_cmd, … … 1951 1951 log_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso); 1952 1952 mds = media_descriptor_string(bkpinfo->backup_media_type); 1953 mr_asprintf( &message_to_screen, "Burning %s #%d", mds, g_current_media_number);1953 mr_asprintf(message_to_screen, "Burning %s #%d", mds, g_current_media_number); 1954 1954 mr_free(mds); 1955 1955 pause_and_ask_for_cdr(2, &cd_is_mountable); … … 1971 1971 if (bkpinfo->call_after_iso[0] != '\0') { 1972 1972 mds = media_descriptor_string(bkpinfo->backup_media_type); 1973 mr_asprintf( &message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);1973 mr_asprintf(message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number); 1974 1974 mr_free(mds); 1975 1975 res = … … 2007 2007 bool ret = TRUE; 2008 2008 2009 mr_asprintf( &command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname);2009 mr_asprintf(command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname); 2010 2010 log_msg(1, "command = '%s'", command); 2011 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));2011 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 2012 2012 mr_free(command); 2013 2013 … … 2083 2083 return (0); 2084 2084 } 2085 mr_asprintf( &tmp, "I am now backing up all large files.");2085 mr_asprintf(tmp, "I am now backing up all large files."); 2086 2086 log_to_screen(tmp); 2087 2087 noof_biggie_files = count_lines_in_file(biggielist_fname); … … 2127 2127 "Calling ntfsclone in background because %s is an NTFS partition", 2128 2128 bigfile_fname); 2129 mr_asprintf( &sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir,2129 mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, 2130 2130 (int) (random() % 32768), 2131 2131 (int) (random() % 32768)); … … 2186 2186 p = bigfile_fname; 2187 2187 } 2188 mr_asprintf( &tmp, "Archiving %s ... ", bigfile_fname);2188 mr_asprintf(tmp, "Archiving %s ... ", bigfile_fname); 2189 2189 if (res) { 2190 2190 mr_strcat(tmp, "Failed!"); … … 2247 2247 for (;;) { 2248 2248 /* backup this set of files */ 2249 mr_asprintf( &curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);2249 mr_asprintf(curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no); 2250 2250 if (! does_file_exist(curr_filelist_fname)) { 2251 2251 mr_free(curr_filelist_fname); … … 2253 2253 } 2254 2254 2255 mr_asprintf( &curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix);2255 mr_asprintf(curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix); 2256 2256 2257 2257 log_msg(1, "EXAT'g set %ld", curr_set_no); 2258 2258 if (g_getfattr) { 2259 mr_asprintf( &curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);2259 mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no); 2260 2260 get_fattr_list(curr_filelist_fname, curr_xattr_list_fname); 2261 2261 } 2262 2262 if (g_getfacl) { 2263 mr_asprintf( &curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);2263 mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no); 2264 2264 get_acl_list(curr_filelist_fname, curr_acl_list_fname); 2265 2265 } … … 2271 2271 retval += res; 2272 2272 if (res) { 2273 mr_asprintf( &tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);2273 mr_asprintf(tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no); 2274 2274 log_to_screen(tmp); 2275 2275 mr_free(tmp); 2276 2276 } 2277 2277 2278 mr_asprintf( &media_usage_comment, "%s", percent_media_full_comment());2278 mr_asprintf(media_usage_comment, "%s", percent_media_full_comment()); 2279 2279 2280 2280 /* copy to CD (scratchdir) ... and an actual CD-R if necessary */ … … 2323 2323 2324 2324 if (res) { 2325 mr_asprintf( &tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);2325 mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no); 2326 2326 log_to_screen(tmp); 2327 2327 mr_free(tmp); … … 2334 2334 } 2335 2335 close_progress_form(); 2336 mr_asprintf( &tmp, "Your regular files have been archived ");2336 mr_asprintf(tmp, "Your regular files have been archived "); 2337 2337 if (retval) { 2338 2338 mr_strcat(tmp, "(with errors)."); … … 2420 2420 mvaddstr_and_log_it(g_currentY, 0, 2421 2421 "Archiving large files to media "); 2422 mr_asprintf( &biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir);2422 mr_asprintf(biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir); 2423 2423 if (g_getfattr) { 2424 mr_asprintf( &xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2424 mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2425 2425 } 2426 2426 if (g_getfacl) { 2427 mr_asprintf( &acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2428 } 2429 2430 mr_asprintf( &command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,2427 mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2428 } 2429 2430 mr_asprintf(command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir, 2431 2431 biggielist); 2432 2432 paranoid_system(command); 2433 2433 mr_free(command); 2434 2434 2435 mr_asprintf( &blah, "biggielist = %s", biggielist);2435 mr_asprintf(blah, "biggielist = %s", biggielist); 2436 2436 log_msg(2, blah); 2437 2437 mr_free(blah); … … 2443 2443 if (g_getfattr) { 2444 2444 get_fattr_list(biggielist, xattr_fname); 2445 mr_asprintf( &command, "cp %s %s/archives/", xattr_fname,2445 mr_asprintf(command, "cp %s %s/archives/", xattr_fname, 2446 2446 bkpinfo->scratchdir); 2447 2447 paranoid_system(command); … … 2450 2450 if (g_getfacl) { 2451 2451 get_acl_list(biggielist, acl_fname); 2452 mr_asprintf( &command, "cp %s %s/archives/", acl_fname, bkpinfo->scratchdir);2452 mr_asprintf(command, "cp %s %s/archives/", acl_fname, bkpinfo->scratchdir); 2453 2453 paranoid_system(command); 2454 2454 mr_free(command); … … 2457 2457 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2458 2458 res += write_EXAT_files_to_tape(xattr_fname, acl_fname); 2459 mr_asprintf( &blah, "%ld", count_lines_in_file(biggielist));2459 mr_asprintf(blah, "%ld", count_lines_in_file(biggielist)); 2460 2460 write_header_block_to_stream((off_t)0, blah, BLK_START_BIGGIEFILES); 2461 2461 mr_free(blah); … … 2533 2533 continue; 2534 2534 } 2535 mr_asprintf( &curr_file, "%s", cf);2535 mr_asprintf(curr_file, "%s", cf); 2536 2536 if (!does_file_exist(curr_file)) { 2537 2537 log_msg(1, … … 2562 2562 continue; 2563 2563 } 2564 mr_asprintf( &curr_file, "%s", cf);2565 2566 mr_asprintf( &tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir);2564 mr_asprintf(curr_file, "%s", cf); 2565 2566 mr_asprintf(tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir); 2567 2567 mr_free(curr_file); 2568 2568 res = run_program_and_log_output(tmp, 5); … … 2636 2636 continue; 2637 2637 } 2638 mr_asprintf( &curr_file, "%s", cf);2638 mr_asprintf(curr_file, "%s", cf); 2639 2639 if (!does_file_exist(curr_file)) { 2640 2640 log_msg(1, … … 2687 2687 char *cdrecord = NULL; 2688 2688 2689 mr_asprintf( &bkp, "%s", cdrw_dev);2689 mr_asprintf(bkp, "%s", cdrw_dev); 2690 2690 if (find_cdrw_device(cdrw_dev)) { 2691 2691 strcpy(cdrw_dev, bkp); 2692 2692 } else { 2693 2693 if (!system("which cdrecord > /dev/null 2> /dev/null")) { 2694 mr_asprintf( &cdrecord, "cdrecord dev=%s -atip", cdrw_dev);2694 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev); 2695 2695 } else if (!system("which dvdrecord > /dev/null 2> /dev/null")) { 2696 mr_asprintf( &cdrecord, "cdrecord dev=%s -atip", cdrw_dev);2696 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev); 2697 2697 } else { 2698 2698 log_msg(2, "Oh well. I guess I'll just pray then."); … … 2753 2753 2754 2754 mds = media_descriptor_string(g_backup_media_type); 2755 mr_asprintf( &tmp, "I am about to burn %s #%d", mds, g_current_media_number);2755 mr_asprintf(tmp, "I am about to burn %s #%d", mds, g_current_media_number); 2756 2756 mr_free(mds); 2757 2757 log_to_screen(tmp); … … 2771 2771 retract_CD_tray_and_defeat_autorun(); 2772 2772 */ 2773 mr_asprintf( &tmp, "umount %s", cdrom_dev);2773 mr_asprintf(tmp, "umount %s", cdrom_dev); 2774 2774 run_program_and_log_output(tmp, 1); 2775 2775 sprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt); … … 2777 2777 sprintf(szunmount, "umount %s", mtpt); 2778 2778 cd_number = -1; 2779 mr_asprintf( &tmp, "mount %s %s", cdrom_dev, mtpt);2780 mr_asprintf( &our_serial_str, "%s", "");2779 mr_asprintf(tmp, "mount %s %s", cdrom_dev, mtpt); 2780 mr_asprintf(our_serial_str, "%s", ""); 2781 2781 attempt_to_mount_returned_this = run_program_and_log_output(tmp, 1); 2782 2782 mr_free(tmp); … … 2807 2807 2808 2808 cd_number = atoi(last_line_of_file(szcdno)); 2809 mr_asprintf( &tmp, "cat %s 2> /dev/null", szserfname);2809 mr_asprintf(tmp, "cat %s 2> /dev/null", szserfname); 2810 2810 mr_free(our_serial_str); 2811 mr_asprintf( &our_serial_str, "%s",2811 mr_asprintf(our_serial_str, "%s", 2812 2812 call_program_and_get_last_line_of_output(tmp)); 2813 2813 mr_free(tmp); … … 2849 2849 } 2850 2850 mds = media_descriptor_string(g_backup_media_type); 2851 mr_asprintf( &tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",2851 mr_asprintf(tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", 2852 2852 mds, g_current_media_number, mds); 2853 2853 mr_free(mds); … … 2994 2994 if (is_this_file_compressed(biggie_filename) 2995 2995 || bkpinfo->compression_level == 0) { 2996 mr_asprintf( &suffix, "%s", "");2996 mr_asprintf(suffix, "%s", ""); 2997 2997 // log_it("%s is indeed compressed :-)", filename); 2998 2998 should_I_compress_slices = FALSE; 2999 2999 } else { 3000 mr_asprintf( &suffix, "%s", bkpinfo->zip_suffix);3000 mr_asprintf(suffix, "%s", bkpinfo->zip_suffix); 3001 3001 should_I_compress_slices = TRUE; 3002 3002 } … … 3014 3014 fatal_error("ntfsresize not found"); 3015 3015 } 3016 mr_asprintf( &command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);3016 mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename); 3017 3017 log_it("command = %s", command); 3018 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));3018 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 3019 3019 mr_free(command); 3020 3020 log_it("res of it = %s", tmp); … … 3024 3024 file_to_openin = biggie_filename; 3025 3025 if (strchr(biggie_filename,'\'') != NULL) { 3026 mr_asprintf( &command, "md5sum \"%s\"", biggie_filename);3026 mr_asprintf(command, "md5sum \"%s\"", biggie_filename); 3027 3027 } else { 3028 mr_asprintf( &command, "md5sum '%s'", biggie_filename);3028 mr_asprintf(command, "md5sum '%s'", biggie_filename); 3029 3029 } 3030 3030 if (!(fin = popen(command, "r"))) { … … 3049 3049 strcpy(biggiestruct.checksum, checksum_line); 3050 3050 3051 mr_asprintf( &tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));3051 mr_asprintf(tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, "")); 3052 3052 fout = fopen(tmp, "w"); 3053 3053 if (fout == NULL) { … … 3067 3067 if (!(fin = fopen(file_to_openin, "r"))) { 3068 3068 log_OS_error("Unable to openin biggie_filename"); 3069 mr_asprintf( &tmp, "Cannot archive bigfile '%s': not found", biggie_filename);3069 mr_asprintf(tmp, "Cannot archive bigfile '%s': not found", biggie_filename); 3070 3070 log_to_screen(tmp); 3071 3071 paranoid_free(tmp); … … 3089 3089 } 3090 3090 for (slice_num = 1; !finished; slice_num++) { 3091 mr_asprintf( &curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));3092 mr_asprintf( &curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));3093 3094 mr_asprintf( &tmp, "%s", percent_media_full_comment());3091 mr_asprintf(curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, "")); 3092 mr_asprintf(curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix)); 3093 3094 mr_asprintf(tmp, "%s", percent_media_full_comment()); 3095 3095 update_progress_form(tmp); 3096 3096 paranoid_free(tmp); … … 3124 3124 } 3125 3125 if (should_I_compress_slices && bkpinfo->compression_level > 0) { 3126 mr_asprintf( &command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed);3126 mr_asprintf(command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed); 3127 3127 log_msg(2, command); 3128 3128 if ((res = system(command))) { … … 3131 3131 // did_I_compress_slice = TRUE; 3132 3132 } else { 3133 mr_asprintf( &command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE);3133 mr_asprintf(command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE); 3134 3134 res = 0; // don't do it :) 3135 3135 // did_I_compress_slice = FALSE; … … 3147 3147 } 3148 3148 if (res) { 3149 mr_asprintf( &tmp, "Problem with slice # %ld", slice_num);3149 mr_asprintf(tmp, "Problem with slice # %ld", slice_num); 3150 3150 } else { 3151 mr_asprintf( &tmp, "%s - Bigfile #%ld, slice #%ld compressed OK ", biggie_filename, biggie_file_number + 1,3151 mr_asprintf(tmp, "%s - Bigfile #%ld, slice #%ld compressed OK ", biggie_filename, biggie_file_number + 1, 3152 3152 slice_num); 3153 3153 } … … 3164 3164 paranoid_free(tmp); 3165 3165 3166 mr_asprintf( &file_to_archive, "%s", curr_slice_fname_compressed);3166 mr_asprintf(file_to_archive, "%s", curr_slice_fname_compressed); 3167 3167 g_current_progress++; 3168 3168 } else { /* if i==0 then ... */ 3169 3169 3170 3170 finished = TRUE; 3171 mr_asprintf( &file_to_archive, "%s", curr_slice_fname_uncompressed);3171 mr_asprintf(file_to_archive, "%s", curr_slice_fname_uncompressed); 3172 3172 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 3173 3173 break; … … 3190 3190 retval += res; 3191 3191 if (res) { 3192 mr_asprintf( &tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);3192 mr_asprintf(tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1); 3193 3193 log_to_screen(tmp); 3194 3194 paranoid_free(tmp); … … 3200 3200 mr_free(suffix); 3201 3201 paranoid_fclose(fin); 3202 mr_asprintf( &tmp, "Sliced bigfile #%ld", biggie_file_number + 1);3202 mr_asprintf(tmp, "Sliced bigfile #%ld", biggie_file_number + 1); 3203 3203 if (retval) { 3204 3204 mr_strcat(tmp, "...FAILED"); … … 3234 3234 assert_string_is_neither_NULL_nor_zerolength(d); 3235 3235 3236 mr_asprintf( &dir, "%s/archives", d);3237 mr_asprintf( &tmp, "find %s -name '*.afio*' -exec rm -f '{}' \\;", dir);3236 mr_asprintf(dir, "%s/archives", d); 3237 mr_asprintf(tmp, "find %s -name '*.afio*' -exec rm -f '{}' \\;", dir); 3238 3238 run_program_and_log_output(tmp, FALSE); 3239 3239 mr_free(tmp); 3240 mr_asprintf( &tmp, "find %s -name '*list.[0-9]*' -exec rm -f '{}' \\;", dir);3240 mr_asprintf(tmp, "find %s -name '*list.[0-9]*' -exec rm -f '{}' \\;", dir); 3241 3241 run_program_and_log_output(tmp, FALSE); 3242 3242 mr_free(tmp); 3243 mr_asprintf( &tmp, "find %s -name 'slice*' -exec rm -f '{}' \\;", dir);3243 mr_asprintf(tmp, "find %s -name 'slice*' -exec rm -f '{}' \\;", dir); 3244 3244 run_program_and_log_output(tmp, FALSE); 3245 3245 mr_free(tmp); 3246 mr_asprintf( &tmp, "rm -f %s/cklist*", dir);3246 mr_asprintf(tmp, "rm -f %s/cklist*", dir); 3247 3247 run_program_and_log_output(tmp, FALSE); 3248 3248 mr_free(tmp); 3249 mr_asprintf( &tmp, "rm -f %s/zero", dir);3249 mr_asprintf(tmp, "rm -f %s/zero", dir); 3250 3250 run_program_and_log_output(tmp, FALSE); 3251 3251 mr_free(tmp); 3252 3252 log_msg(1, "Wiped %s's archives", dir); 3253 mr_asprintf( &tmp, "ls -l %s", dir);3253 mr_asprintf(tmp, "ls -l %s", dir); 3254 3254 mr_free(dir); 3255 3255 run_program_and_log_output(tmp, FALSE); … … 3507 3507 log_msg(2, 3508 3508 "Not verifying again. Per-CD/ISO verification already carried out."); 3509 mr_asprintf( &tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MONDO_CACHE);3509 mr_asprintf(tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MONDO_CACHE); 3510 3510 paranoid_system(tmp); 3511 3511 mr_free(tmp); … … 3532 3532 if (res) { 3533 3533 mds = media_descriptor_string(bkpinfo->backup_media_type); 3534 mr_asprintf( &tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);3534 mr_asprintf(tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number); 3535 3535 mr_free(mds); 3536 3536 log_to_screen(tmp); … … 3539 3539 } 3540 3540 } 3541 mr_asprintf( &tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);3541 mr_asprintf(tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE); 3542 3542 res = system(tmp); 3543 3543 mr_free(tmp); 3544 3544 3545 mr_asprintf( &tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);3545 mr_asprintf(tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE); 3546 3546 res = system(tmp); 3547 3547 mr_free(tmp); … … 3552 3552 } 3553 3553 } 3554 mr_asprintf( &tmp, "%s/changed.files", MONDO_CACHE);3554 mr_asprintf(tmp, "%s/changed.files", MONDO_CACHE); 3555 3555 diffs = count_lines_in_file(tmp); 3556 3556 mr_free(tmp); -
branches/3.0/mondo/src/common/libmondo-cli.c
r3154 r3185 97 97 for (i = 0; i < 128; i++) { 98 98 if (flag_set[i]) { 99 mr_asprintf( &tmp, "-%c %s", i, flag_val[i]);99 mr_asprintf(tmp, "-%c %s", i, flag_val[i]); 100 100 log_msg(3, tmp); 101 101 mr_free(tmp); … … 246 246 } 247 247 248 mr_asprintf( &tmp1, "%s", flag_val['I']);248 mr_asprintf(tmp1, "%s", flag_val['I']); 249 249 p = tmp1; 250 250 q = tmp1; … … 448 448 if (p == NULL) { 449 449 /* protocol not found assuming NFS for compatibility */ 450 mr_asprintf( &q,"nfs");450 mr_asprintf(q,"nfs"); 451 451 452 452 p = strchr(bkpinfo->netfs_mount, ':'); … … 460 460 /* Isolate the protocol */ 461 461 *p = '\0'; 462 mr_asprintf( &q,"%s",bkpinfo->netfs_mount);462 mr_asprintf(q,"%s",bkpinfo->netfs_mount); 463 463 464 464 /* Skip proto now */ … … 484 484 p--; 485 485 *p = '\0'; 486 mr_asprintf( &q,"%s",bkpinfo->netfs_mount);486 mr_asprintf(q,"%s",bkpinfo->netfs_mount); 487 487 bkpinfo->netfs_user = q; 488 488 strcpy(bkpinfo->netfs_mount,tmp); … … 578 578 if (flag_set['z']) { 579 579 if (find_home_of_exe("getfattr")) { 580 mr_asprintf( &g_getfattr,"getfattr");580 mr_asprintf(g_getfattr,"getfattr"); 581 581 } 582 582 if (find_home_of_exe("getfacl")) { 583 mr_asprintf( &g_getfacl,"getfacl");583 mr_asprintf(g_getfacl,"getfacl"); 584 584 } 585 585 } … … 595 595 log_to_screen("Please supply a sensible value with '-E'\n"); 596 596 } 597 mr_asprintf( &tmp1, "%s", flag_val['E']);597 mr_asprintf(tmp1, "%s", flag_val['E']); 598 598 599 599 p = tmp1; … … 656 656 657 657 if (flag_set['b']) { 658 mr_asprintf( &psz, "%s", flag_val['b']);658 mr_asprintf(psz, "%s", flag_val['b']); 659 659 log_msg(1, "psz = '%s'", psz); 660 660 if (psz[strlen(psz) - 1] == 'k') { … … 730 730 731 731 if ((flag_set['n']) && (! bkpinfo->restore_data)) { 732 mr_asprintf( &tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->netfs_remote_dir);732 mr_asprintf(tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->netfs_remote_dir); 733 733 if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) { 734 734 sprintf(tmp, "su - %s -c \"echo hi > %s\"", bkpinfo->netfs_user, tmp1); … … 1003 1003 if (flag_set[opt]) { 1004 1004 bad_switches = TRUE; 1005 mr_asprintf( &tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);1005 mr_asprintf(tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]); 1006 1006 log_to_screen(tmp); 1007 1007 paranoid_free(tmp); … … 1019 1019 if (strchr(flag_val[opt], '/') 1020 1020 && flag_val[opt][0] != '/') { 1021 mr_asprintf( &tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);1021 mr_asprintf(tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]); 1022 1022 log_to_screen(tmp); 1023 1023 paranoid_free(tmp); … … 1032 1032 for (i = optind; i < argc; i++) { 1033 1033 bad_switches = TRUE; 1034 mr_asprintf( &tmp, "Invalid arg -- %s\n", argv[i]);1034 mr_asprintf(tmp, "Invalid arg -- %s\n", argv[i]); 1035 1035 log_to_screen(tmp); 1036 1036 paranoid_free(tmp); … … 1063 1063 switch (sig) { 1064 1064 case SIGINT: 1065 mr_asprintf( &tmp, "SIGINT");1066 mr_asprintf( &tmp2, "You interrupted me :-)");1065 mr_asprintf(tmp, "SIGINT"); 1066 mr_asprintf(tmp2, "You interrupted me :-)"); 1067 1067 break; 1068 1068 case SIGKILL: 1069 mr_asprintf( &tmp, "SIGKILL");1070 mr_asprintf( &tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system.");1069 mr_asprintf(tmp, "SIGKILL"); 1070 mr_asprintf(tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system."); 1071 1071 break; 1072 1072 case SIGTERM: 1073 mr_asprintf( &tmp, "SIGTERM");1074 mr_asprintf( &tmp2, "Got terminate signal");1073 mr_asprintf(tmp, "SIGTERM"); 1074 mr_asprintf(tmp2, "Got terminate signal"); 1075 1075 break; 1076 1076 case SIGHUP: 1077 mr_asprintf( &tmp, "SIGHUP");1078 mr_asprintf( &tmp2, "Hangup on line");1077 mr_asprintf(tmp, "SIGHUP"); 1078 mr_asprintf(tmp2, "Hangup on line"); 1079 1079 break; 1080 1080 case SIGSEGV: 1081 mr_asprintf( &tmp, "SIGSEGV");1082 mr_asprintf( &tmp2, "Internal programming error. Please send a backtrace as well as your log.");1081 mr_asprintf(tmp, "SIGSEGV"); 1082 mr_asprintf(tmp2, "Internal programming error. Please send a backtrace as well as your log."); 1083 1083 break; 1084 1084 case SIGPIPE: 1085 mr_asprintf( &tmp, "SIGPIPE");1086 mr_asprintf( &tmp2, "Pipe was broken");1085 mr_asprintf(tmp, "SIGPIPE"); 1086 mr_asprintf(tmp2, "Pipe was broken"); 1087 1087 break; 1088 1088 case SIGABRT: 1089 mr_asprintf( &tmp, "SIGABRT");1090 mr_asprintf( &tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");1089 mr_asprintf(tmp, "SIGABRT"); 1090 mr_asprintf(tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message."); 1091 1091 break; 1092 1092 default: 1093 mr_asprintf( &tmp, "(Unknown)");1094 mr_asprintf( &tmp2, "(Unknown)");1093 mr_asprintf(tmp, "(Unknown)"); 1094 mr_asprintf(tmp2, "(Unknown)"); 1095 1095 } 1096 1096 -
branches/3.0/mondo/src/common/libmondo-devices.c
r3171 r3185 131 131 132 132 malloc_string(comment); 133 mr_asprintf( &tmp, "%s", where_is_root_mounted());133 mr_asprintf(tmp, "%s", where_is_root_mounted()); 134 134 sprintf(comment, "root is mounted at %s\n", tmp); 135 135 log_msg(0, comment); … … 555 555 run_program_and_log_output("insmod ide-scsi", -1); 556 556 if (find_home_of_exe("cdrecord")) { 557 mr_asprintf( &cdr_exe, "cdrecord");557 mr_asprintf(cdr_exe, "cdrecord"); 558 558 } else { 559 mr_asprintf( &cdr_exe, "dvdrecord");559 mr_asprintf(cdr_exe, "dvdrecord"); 560 560 } 561 561 if (find_home_of_exe(cdr_exe)) { … … 563 563 "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -E '[D|C][V|D]' | cut -d' ' -f2 | head -n1", 564 564 cdr_exe); 565 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));565 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 566 566 } 567 567 if ((tmp == NULL) || (strlen(tmp) < 2)) { … … 653 653 654 654 if (find_home_of_exe("cdrecord")) { 655 mr_asprintf( &cdr_exe, "cdrecord");655 mr_asprintf(cdr_exe, "cdrecord"); 656 656 } else { 657 mr_asprintf( &cdr_exe, "dvdrecord");657 mr_asprintf(cdr_exe, "dvdrecord"); 658 658 } 659 659 tmp[0] = '\0'; … … 876 876 cdr_exe, g_cdrw_drive_is_here); 877 877 log_msg(1, "command=%s", command); 878 mr_asprintf( &tmp1, "%s", call_program_and_get_last_line_of_output(command));878 mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output(command)); 879 879 if (strlen(tmp1) > 0) { 880 880 strcpy(output, tmp1); … … 1134 1134 log_msg(1, "%s needs to have a '/' prefixed - I'll do it", 1135 1135 device_raw); 1136 mr_asprintf( &tmp, "/%s", device_raw);1136 mr_asprintf(tmp, "/%s", device_raw); 1137 1137 } else { 1138 mr_asprintf( &tmp, "%s", device_raw);1138 mr_asprintf(tmp, "%s", device_raw); 1139 1139 } 1140 1140 log_msg(1, "Is %s mounted?", tmp); … … 1145 1145 return(FALSE); 1146 1146 } 1147 mr_asprintf( &device_with_tab, "%s\t", tmp);1148 mr_asprintf( &device_with_space, "%s ", tmp);1147 mr_asprintf(device_with_tab, "%s\t", tmp); 1148 mr_asprintf(device_with_space, "%s ", tmp); 1149 1149 mr_free(tmp); 1150 1150 … … 1165 1165 mr_free(device_with_tab); 1166 1166 paranoid_pclose(fin); 1167 mr_asprintf( &tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);1167 mr_asprintf(tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space); 1168 1168 mr_free(device_with_space); 1169 1169 log_msg(4, "tmp (command) = '%s'", tmp); … … 1309 1309 } 1310 1310 #ifndef __FreeBSD__ 1311 mr_asprintf( &options, "ro");1311 mr_asprintf(options, "ro"); 1312 1312 #endif 1313 1313 … … 1315 1315 1316 1316 #ifdef __FreeBSD__ 1317 mr_asprintf( &dev, "%s", make_vn(device));1317 mr_asprintf(dev, "%s", make_vn(device)); 1318 1318 if (!dev) { 1319 mr_asprintf( &command, "Unable to mount ISO (make_vn(%s) failed)", device);1319 mr_asprintf(command, "Unable to mount ISO (make_vn(%s) failed)", device); 1320 1320 fatal_error(command); 1321 1321 } … … 1332 1332 1333 1333 #ifdef __FreeBSD__ 1334 mr_asprintf( &command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);1334 mr_asprintf(command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE); 1335 1335 1336 1336 #else 1337 mr_asprintf( &command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);1337 mr_asprintf(command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE); 1338 1338 paranoid_free(options); 1339 1339 #endif … … 1407 1407 } else if (bkpinfo->backup_media_type == iso) { 1408 1408 if (bkpinfo->subdir) { 1409 mr_asprintf( &mountdir, "%s/%s", bkpinfo->isodir, bkpinfo->subdir);1409 mr_asprintf(mountdir, "%s/%s", bkpinfo->isodir, bkpinfo->subdir); 1410 1410 } else { 1411 mr_asprintf( &mountdir, "%s", bkpinfo->isodir);1411 mr_asprintf(mountdir, "%s", bkpinfo->isodir); 1412 1412 } 1413 1413 #ifdef __FreeBSD__ … … 1673 1673 ********/ 1674 1674 /* Get the number of mounted file systems ((those that start with "/dev/" */ 1675 mr_asprintf( &command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");1675 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l"); 1676 1676 log_msg(5, "Running: %s", command); 1677 mr_asprintf( &mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));1677 mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command)); 1678 1678 paranoid_free(command); 1679 1679 … … 1683 1683 1684 1684 for (i=mount_cnt; i > 0; i--) { 1685 mr_asprintf( &command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);1685 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i); 1686 1686 log_msg(5, "Running: %s", command); 1687 mr_asprintf( &mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));1687 mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command)); 1688 1688 paranoid_free(command); 1689 1689 … … 1770 1770 log_msg(4, " %s looks like a device special file", dsf); 1771 1771 /* Verify that the dsf exists */ 1772 mr_asprintf( &command, "ls -al %s 2>/dev/null | wc -l", dsf);1772 mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf); 1773 1773 log_msg(5, " Executing: %s", command); 1774 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1774 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1775 1775 paranoid_free(command); 1776 1776 … … 1796 1796 * Either way, it's an error. 1797 1797 ********/ 1798 mr_asprintf( &command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);1798 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf); 1799 1799 log_msg(5, "Executing: %s", command); 1800 mr_asprintf( &partition_list, "%s", call_program_and_get_last_line_of_output(command));1800 mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command)); 1801 1801 paranoid_free(command); 1802 1802 log_msg(4, "Partition list for %s: %s", dsf, partition_list); … … 1816 1816 mr_free(token); 1817 1817 } 1818 mr_asprintf( &ndsf, "%s", dsf);1818 mr_asprintf(ndsf, "%s", dsf); 1819 1819 } 1820 1820 mr_free(partition_list); … … 1862 1862 log_msg(4, "Processing partition: %s", partitions[i]); 1863 1863 /* See if it's swap. If it is, ignore it. */ 1864 mr_asprintf( &command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",1864 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", 1865 1865 ndsf, partitions[i]); 1866 1866 log_msg(5, " Running: %s", command); 1867 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1867 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1868 1868 paranoid_free(command); 1869 1869 log_msg(5, " Return value: %s", tmp); … … 1875 1875 } 1876 1876 /* It's not swap. See if we can find the mount point from the mount command. */ 1877 mr_asprintf( &command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);1878 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1877 mr_asprintf(command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]); 1878 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1879 1879 paranoid_free(command); 1880 1880 if (strlen(tmp)) { … … 1893 1893 log_msg(4, " It's not mounted. Checking to see if it's LVM..."); 1894 1894 /* Check for LVM */ 1895 mr_asprintf( &command, "pvdisplay -c %s 2> /dev/null", partitions[i]);1895 mr_asprintf(command, "pvdisplay -c %s 2> /dev/null", partitions[i]); 1896 1896 log_msg(5, " Running: %s", command); 1897 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1897 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1898 1898 paranoid_free(command); 1899 1899 if (strlen(tmp)) { 1900 1900 log_msg(4, "Found an LVM partition at %s. Find the VG it's in...", partitions[i]); 1901 1901 /* It's LVM: Find the VG it's in */ 1902 mr_asprintf( &command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);1902 mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]); 1903 1903 log_msg(5, " Running: %s", command); 1904 1904 strcpy(VG, call_program_and_get_last_line_of_output(command)); … … 1908 1908 /* Found the Volume Group. Now find all of the VG's mount points */ 1909 1909 log_msg(4, " Found the Volume Group. Now find all of the VG's mount points"); 1910 mr_asprintf( &command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);1910 mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG); 1911 1911 log_msg(5, " Running: %s", command); 1912 mr_asprintf( &mount_list, "%s", call_program_and_get_last_line_of_output(command));1912 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command)); 1913 1913 paranoid_free(command); 1914 1914 log_msg(4, " VG %s mount_list: %s", VG, mount_list); … … 1931 1931 paranoid_free(mount_list); 1932 1932 1933 mr_asprintf( &command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");1933 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 1934 1934 log_msg (5, "Running: %s", command); 1935 mr_asprintf( &mount_list, "%s", call_program_and_get_last_line_of_output(command));1935 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command)); 1936 1936 paranoid_free(command); 1937 1937 log_msg(4, " Software raid device list: %s", mount_list); 1938 1938 lastpos = 0; 1939 1939 while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) { 1940 mr_asprintf( &command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);1940 mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG); 1941 1941 log_msg (5, "Running: %s", command); 1942 1942 paranoid_free(tmp); 1943 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1943 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1944 1944 paranoid_free(command); 1945 1945 log_msg(4, "Number of Software raid device: %s", tmp); … … 1972 1972 ********/ 1973 1973 log_msg (5, "It's not swap, mounted, or LVM. See if it's used in a software raid device."); 1974 mr_asprintf( &command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);1974 mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]); 1975 1975 log_msg(4, " Running: %s", command); 1976 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1976 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1977 1977 paranoid_free(command); 1978 1978 if (!strlen(tmp)) { … … 1983 1983 log_msg (5, " UUID: %s", tmp); 1984 1984 /* Get the Software raid device list */ 1985 mr_asprintf( &command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");1985 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 1986 1986 log_msg (5, " Running: %s", command); 1987 mr_asprintf( &mount_list, "%s", call_program_and_get_last_line_of_output(command));1987 mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command)); 1988 1988 paranoid_free(command); 1989 1989 log_msg(4, " Software raid device list: %s", mount_list); … … 1991 1991 lastpos = 0; 1992 1992 while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) { 1993 mr_asprintf( &command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);1993 mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp); 1994 1994 log_msg(4, " Running: %s", command); 1995 1995 paranoid_free(tmp); 1996 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1996 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1997 1997 paranoid_free(command); 1998 1998 if (!atoi(tmp)) { … … 2088 2088 mr_strcat(bkpinfo->exclude_paths,"|%s",mounted_on_dsf); 2089 2089 } else { 2090 mr_asprintf( &(bkpinfo->exclude_paths),"%s",mounted_on_dsf);2090 mr_asprintf(bkpinfo->exclude_paths,"%s",mounted_on_dsf); 2091 2091 } 2092 2092 if (bkpinfo->exclude_devs) { 2093 2093 mr_strcat(bkpinfo->exclude_devs,"|%s",token); 2094 2094 } else { 2095 mr_asprintf( &(bkpinfo->exclude_devs),"%s",token);2095 mr_asprintf(bkpinfo->exclude_devs,"%s",token); 2096 2096 } 2097 2097 } … … 2107 2107 mr_strcat(bkpinfo->exclude_paths, "|%s",not_mounted_on_dsf); 2108 2108 } else { 2109 mr_asprintf( &(bkpinfo->exclude_paths),"%s",not_mounted_on_dsf);2109 mr_asprintf(bkpinfo->exclude_paths,"%s",not_mounted_on_dsf); 2110 2110 } 2111 2111 } … … 2119 2119 case -1: 2120 2120 /* Adds a | to ensure correct detection even at both ends */ 2121 mr_asprintf( &tmp1,"|%s",token);2122 mr_asprintf( &tmp2,"|%s|",token);2121 mr_asprintf(tmp1,"|%s",token); 2122 mr_asprintf(tmp2,"|%s|",token); 2123 2123 if (mode == 'E') { 2124 2124 /* Add the token if not already in the list */ 2125 mr_asprintf( &tmp,"|%s|",bkpinfo->exclude_paths);2125 mr_asprintf(tmp,"|%s|",bkpinfo->exclude_paths); 2126 2126 if (strstr(tmp,tmp2) == NULL) { 2127 2127 if (bkpinfo->exclude_paths) { … … 2134 2134 } else { 2135 2135 /* Add the token if not already in the list */ 2136 mr_asprintf( &tmp,"|%s|",bkpinfo->include_paths);2136 mr_asprintf(tmp,"|%s|",bkpinfo->include_paths); 2137 2137 if (strstr(tmp,tmp2) == NULL) { 2138 2138 strcat(bkpinfo->include_paths,tmp1); … … 2219 2219 */ 2220 2220 #ifdef __FreeBSD__ 2221 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,vmhgfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));2221 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,vmhgfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done")); 2222 2222 #else 2223 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x vmhgfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));2223 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x vmhgfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done")); 2224 2224 #endif 2225 2225 2226 2226 if (tmp[0] != '/') { 2227 mr_asprintf( &sz, "%s", tmp);2227 mr_asprintf(sz, "%s", tmp); 2228 2228 mr_free(tmp); 2229 mr_asprintf( &tmp, "/%s", sz);2229 mr_asprintf(tmp, "/%s", sz); 2230 2230 mr_free(sz); 2231 2231 } … … 2337 2337 if (bkpinfo->media_device[0]) { 2338 2338 if (bkpinfo->backup_media_type == usb) { 2339 mr_asprintf( &tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);2339 mr_asprintf(tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device); 2340 2340 } else { 2341 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);2341 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); 2342 2342 } 2343 2343 if (!ask_me_yes_or_no(tmp)) { … … 2405 2405 } 2406 2406 if (bkpinfo->media_device[0]) { 2407 mr_asprintf( &tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);2407 mr_asprintf(tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device); 2408 2408 if (!ask_me_yes_or_no(tmp)) { 2409 2409 bkpinfo->media_device[0] = '\0'; … … 2420 2420 } 2421 2421 } 2422 mr_asprintf( &tmp, "ls -l %s", bkpinfo->media_device);2422 mr_asprintf(tmp, "ls -l %s", bkpinfo->media_device); 2423 2423 if (run_program_and_log_output(tmp, FALSE)) { 2424 2424 log_to_screen("User has not specified a valid /dev entry"); … … 2535 2535 /* Force NFS to be the protocol by default */ 2536 2536 if (bkpinfo->netfs_proto == NULL) { 2537 mr_asprintf( &(bkpinfo->netfs_proto), "nfs");2537 mr_asprintf(bkpinfo->netfs_proto, "nfs"); 2538 2538 } 2539 2539 if (bkpinfo->disaster_recovery) { … … 2549 2549 } 2550 2550 mr_free(bkpinfo->netfs_proto); 2551 mr_asprintf( &(bkpinfo->netfs_proto), "%s", tmp1);2551 mr_asprintf(bkpinfo->netfs_proto, "%s", tmp1); 2552 2552 if (!popup_and_get_string 2553 2553 ("Network share", "Which remote share should I mount?", … … 2570 2570 mr_free(bkpinfo->netfs_user); 2571 2571 if (strcmp(tmp1, "") != 0) { 2572 mr_asprintf( &(bkpinfo->netfs_user), "%s", tmp1);2572 mr_asprintf(bkpinfo->netfs_user, "%s", tmp1); 2573 2573 } 2574 2574 … … 2585 2585 if (bkpinfo->restore_data) { 2586 2586 /* mount th FS read-only in restore mode to avoid any erase of whatever */ 2587 mr_asprintf( &tmpro, "-o ro");2587 mr_asprintf(tmpro, "-o ro"); 2588 2588 } else { 2589 mr_asprintf( &tmpro, "");2589 mr_asprintf(tmpro, ""); 2590 2590 } 2591 2591 2592 2592 /* Build the mount string */ 2593 2593 if (strstr(bkpinfo->netfs_proto, "smbfs")) { 2594 mr_asprintf( &tmp, "mount -t cifs %s %s %s",bkpinfo->netfs_mount, bkpinfo->isodir,tmpro);2594 mr_asprintf(tmp, "mount -t cifs %s %s %s",bkpinfo->netfs_mount, bkpinfo->isodir,tmpro); 2595 2595 if (bkpinfo->netfs_user) { 2596 2596 mr_strcat(tmp, " -o user=%s", bkpinfo->netfs_user); … … 2598 2598 else { 2599 2599 if (strstr(bkpinfo->netfs_proto, "sshfs")) { 2600 mr_asprintf( &tmp, "sshfs %s ",tmpro);2600 mr_asprintf(tmp, "sshfs %s ",tmpro); 2601 2601 } else { 2602 mr_asprintf( &tmp, "mount -t %s -o nolock %s ", bkpinfo->netfs_proto,tmpro);2602 mr_asprintf(tmp, "mount -t %s -o nolock %s ", bkpinfo->netfs_proto,tmpro); 2603 2603 } 2604 2604 if (bkpinfo->netfs_user) { … … 2788 2788 } 2789 2789 mr_free(bkpinfo->exclude_paths); 2790 mr_asprintf( &tmp, "%s", p);2790 mr_asprintf(tmp, "%s", p); 2791 2791 bkpinfo->exclude_paths = tmp; 2792 2792 … … 2815 2815 if (ask_me_yes_or_no("Do you want to backup extended attributes?")) { 2816 2816 if (find_home_of_exe("getfattr")) { 2817 mr_asprintf( &g_getfattr,"getfattr");2817 mr_asprintf(g_getfattr,"getfattr"); 2818 2818 } 2819 2819 if (find_home_of_exe("getfacl")) { 2820 mr_asprintf( &g_getfacl,"getfacl");2820 mr_asprintf(g_getfacl,"getfacl"); 2821 2821 } 2822 2822 log_it("Backup of extended attributes"); … … 2934 2934 char *exclude_these_directories = NULL; 2935 2935 2936 mr_asprintf( &exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,vmhgfs,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' '|' | awk '{print $0;}'"));2936 mr_asprintf(exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,vmhgfs,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' '|' | awk '{print $0;}'")); 2937 2937 log_msg(9,"list_of_NETFS_mounts_only returns %s\n",exclude_these_directories); 2938 2938 return(exclude_these_directories); … … 3033 3033 // log_it("Asking what_number_cd_is_this"); 3034 3034 if (g_ISO_restore_mode) { 3035 mr_asprintf( &tmp, "mount | grep iso9660 | awk '{print $3;}'");3036 3037 mr_asprintf( &mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");3035 mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'"); 3036 3037 mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER"); 3038 3038 cd_number = atoi(last_line_of_file(mountdev)); 3039 3039 paranoid_free(mountdev); … … 3043 3043 } 3044 3044 3045 mr_asprintf( &mountdev, "%s", bkpinfo->media_device);3045 mr_asprintf(mountdev, "%s", bkpinfo->media_device); 3046 3046 if (!mountdev[0]) { 3047 3047 log_it … … 3177 3177 assert(which_device != NULL); 3178 3178 3179 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());3179 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()); 3180 3180 log_it("list_drives_cmd = %s", list_drives_cmd); 3181 3181 … … 3219 3219 } else { 3220 3220 // We need to look on each partition then 3221 mr_asprintf( &list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");3221 mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/"); 3222 3222 log_it("list_drives_cmd = %s", list_drives_cmd); 3223 3223 … … 3322 3322 log_msg(1, "curr_fname = %s", curr_fname); 3323 3323 sprintf(command, "file %s", curr_fname); 3324 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));3324 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 3325 3325 for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' '; 3326 3326 p--); 3327 3327 p++; 3328 mr_asprintf( &scratch, "%s", p);3328 mr_asprintf(scratch, "%s", p); 3329 3329 for (p = scratch; *p != '\0' && *p != '\''; p++); 3330 3330 *p = '\0'; … … 3373 3373 sprintf(fdisk, "/sbin/parted2fdisk"); 3374 3374 sprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive); 3375 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));3375 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 3376 3376 if (strstr(tmp, "GPT") == NULL) { 3377 3377 strcpy(output, "MBR"); -
branches/3.0/mondo/src/common/libmondo-fifo.c
r2519 r3185 88 88 for (bufsize = wise_upper_limit, res = -1; 89 89 res != 0 && bufsize >= wise_lower_limit; bufsize--) { 90 mr_asprintf( &tmp,90 mr_asprintf(tmp, 91 91 "dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c", 92 92 internal_tape_block_size, bufsize, 'm'); … … 96 96 if (!res) { 97 97 bufsize++; 98 mr_asprintf( &tmp, "Negotiated max buffer of %d MB ", bufsize);98 mr_asprintf(tmp, "Negotiated max buffer of %d MB ", bufsize); 99 99 log_to_screen(tmp); 100 100 mr_free(tmp); … … 120 120 } 121 121 log_msg(2, "Calling buffer --- command = '%s'", g_sz_call_to_buffer); 122 mr_asprintf( &sz_dir, "%c", direction);122 mr_asprintf(sz_dir, "%c", direction); 123 123 fres = popen(g_sz_call_to_buffer, sz_dir); 124 124 mr_free(sz_dir); … … 132 132 } 133 133 sleep(2); 134 mr_asprintf( &tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);134 mr_asprintf(tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer); 135 135 if (run_program_and_log_output(tmp, 2)) { 136 136 log_msg(2, "Warning - I think I failed to open tape, actually."); … … 138 138 mr_free(tmp); 139 139 g_tape_buffer_size_MB = bufsize; 140 mr_asprintf( &command, "ps %s | grep buffer | grep -v grep", ps_options);140 mr_asprintf(command, "ps %s | grep buffer | grep -v grep", ps_options); 141 141 if (run_program_and_log_output(command, 1)) { 142 142 fres = NULL; … … 167 167 } 168 168 paranoid_system("sync"); 169 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);169 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); 170 170 log_msg(2, "kill_buffer() --- command = %s", command); 171 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));171 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 172 172 mr_free(command); 173 173 174 mr_asprintf( &command, "kill %s", tmp);174 mr_asprintf(command, "kill %s", tmp); 175 175 log_msg(2, "kill_buffer() --- command = %s", command); 176 176 if (strlen(tmp) > 0) { -
branches/3.0/mondo/src/common/libmondo-filelist.c
r3171 r3185 96 96 log_to_screen("Dividing filelist into sets. Please wait."); 97 97 i = 0; 98 mr_asprintf( &filelist, "%s/archives/filelist.full", bkpinfo->scratchdir);98 mr_asprintf(filelist, "%s/archives/filelist.full", bkpinfo->scratchdir); 99 99 if (!does_file_exist(filelist)) { 100 100 log_it("filelist %s not found", filelist); … … 107 107 estimate_noof_media_required(noof_sets); // for cosmetic purposes 108 108 109 mr_asprintf( &tempfile, "%s/biggielist.txt", bkpinfo->tmpdir);109 mr_asprintf(tempfile, "%s/biggielist.txt", bkpinfo->tmpdir); 110 110 if (!(fout = fopen(tempfile, "a"))) { 111 111 log_OS_error("Cannot append to biggielist"); … … 157 157 } // no sense in trying to sort an empty file 158 158 159 mr_asprintf( &tmp_fname, "%s/sortfile", bkpinfo->tmpdir);160 161 mr_asprintf( &command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE);159 mr_asprintf(tmp_fname, "%s/sortfile", bkpinfo->tmpdir); 160 161 mr_asprintf(command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE); 162 162 retval = system(command); 163 163 mr_free(command); … … 167 167 } else { 168 168 log_msg(5, "Sorted %s --> %s OK. Copying it back to %s now", orig_fname, tmp_fname, orig_fname); 169 mr_asprintf( &command, "mv -f %s %s", tmp_fname, orig_fname);169 mr_asprintf(command, "mv -f %s %s", tmp_fname, orig_fname); 170 170 retval += run_program_and_log_output(command, 5); 171 171 mr_free(command); … … 237 237 curr_set_no = 0; 238 238 curr_set_size = 0; 239 mr_asprintf( &outfname, "%s/filelist.%ld", outdir, curr_set_no);240 mr_asprintf( &biggie_fname, "%s/biggielist.txt", outdir);239 mr_asprintf(outfname, "%s/filelist.%ld", outdir, curr_set_no); 240 mr_asprintf(biggie_fname, "%s/biggielist.txt", outdir); 241 241 log_it("outfname=%s; biggie_fname=%s", outfname, biggie_fname); 242 242 if (!(fbig = fopen(biggie_fname, "w"))) { … … 255 255 } 256 256 257 mr_getline( &incoming, fin);257 mr_getline(incoming, fin); 258 258 while (!feof(fin)) { 259 259 lino++; … … 288 288 curr_set_size = 0; 289 289 290 mr_asprintf( &outfname, "%s/filelist.%ld", outdir, curr_set_no);290 mr_asprintf(outfname, "%s/filelist.%ld", outdir, curr_set_no); 291 291 if (!(fout = fopen(outfname, "w"))) { 292 292 log_OS_error("Unable to openout outfname"); … … 301 301 } 302 302 mr_free(incoming); 303 mr_getline( &incoming, fin);303 mr_getline(incoming, fin); 304 304 } 305 305 mr_free(incoming); … … 320 320 mr_free(biggie_fname); 321 321 322 mr_asprintf( &outfname, "%s/LAST-FILELIST-NUMBER", outdir);323 mr_asprintf( &tmp, "%ld", curr_set_no);322 mr_asprintf(outfname, "%s/LAST-FILELIST-NUMBER", outdir); 323 mr_asprintf(tmp, "%ld", curr_set_no); 324 324 if (write_one_liner_data_file(outfname, tmp)) { 325 325 log_OS_error … … 331 331 332 332 if (curr_set_no == 0) { 333 mr_asprintf( &tmp, "Only one fileset. Fine.");333 mr_asprintf(tmp, "Only one fileset. Fine."); 334 334 } else { 335 mr_asprintf( &tmp, "Filelist divided into %ld sets", curr_set_no + 1);335 mr_asprintf(tmp, "Filelist divided into %ld sets", curr_set_no + 1); 336 336 } 337 337 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( &syscall, "%s '%s' 2>> /dev/null", syscall_sprintf, tmp); // " MONDO_LOGFILE);473 mr_asprintf(syscall, "%s '%s' 2>> /dev/null", syscall_sprintf, tmp); // " MONDO_LOGFILE); 474 474 paranoid_free(tmp); 475 475 log_msg(20,"calling %s\n",syscall); … … 490 490 491 491 if (g_getfacl != NULL) { 492 mr_asprintf( &command, "touch \"%s\"", facl_fname);492 mr_asprintf(command, "touch \"%s\"", facl_fname); 493 493 run_program_and_log_output(command, 8); 494 494 mr_free(command); … … 506 506 507 507 if (g_getfattr != NULL) { 508 mr_asprintf( &command, "touch \"%s\"", fattr_fname);508 mr_asprintf(command, "touch \"%s\"", fattr_fname); 509 509 run_program_and_log_output(command, 8); 510 510 mr_free(command); … … 538 538 if (strstr(executable,"acl")) { 539 539 /* setfacl needs no additional option for physical walk */ 540 mr_asprintf( &tmp,"");540 mr_asprintf(tmp,""); 541 541 } else { 542 542 /* setfattr needs option -h for physical walk */ 543 mr_asprintf( &tmp,"-h");544 } 545 mr_asprintf( &command, "gzip -dc %s | %s %s --restore - 2>> %s", original_exat_fname, executable, tmp, MONDO_LOGFILE);543 mr_asprintf(tmp,"-h"); 544 } 545 mr_asprintf(command, "gzip -dc %s | %s %s --restore - 2>> %s", original_exat_fname, executable, tmp, MONDO_LOGFILE); 546 546 mr_free(tmp); 547 547 log_msg(1, "command = %s", command); … … 560 560 malloc_string(current_subset_file); 561 561 malloc_string(current_master_file); 562 mr_asprintf( &masklist, "%s/masklist", bkpinfo->tmpdir);563 mr_asprintf( &command, "cp -f %s %s", orig_msklist, masklist);562 mr_asprintf(masklist, "%s/masklist", bkpinfo->tmpdir); 563 mr_asprintf(command, "cp -f %s %s", orig_msklist, masklist); 564 564 run_program_and_log_output(command, 1); 565 565 mr_free(command); … … 568 568 current_subset_file[0] = current_master_file[0] = '\0'; 569 569 570 mr_asprintf( &syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE);570 mr_asprintf(syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE); 571 571 log_msg(1, "syscall_pout = %s", syscall_pout); 572 572 pout = popen(syscall_pout, "w"); … … 579 579 } 580 580 581 mr_asprintf( &syscall_pin, "gzip -dc %s", original_exat_fname);581 mr_asprintf(syscall_pin, "gzip -dc %s", original_exat_fname); 582 582 log_msg(1, "syscall_pin = %s", syscall_pin); 583 583 pin = popen(syscall_pin, "r"); … … 720 720 721 721 strcpy(val_sz,""); 722 mr_asprintf( &cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir);722 mr_asprintf(cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir); 723 723 read_cfg_var(cfg_fname, "last-filelist-number", val_sz); 724 724 mr_free(cfg_fname); … … 882 882 } 883 883 log_to_screen("Loading filelist"); 884 mr_asprintf( &tmp1, "zcat %s | wc -l", filelist_fname);884 mr_asprintf(tmp1, "zcat %s | wc -l", filelist_fname); 885 885 log_msg(6, "tmp1 = %s", tmp1); 886 886 lines_in_filelist = atol(call_program_and_get_last_line_of_output(tmp1)); … … 902 902 (filelist->down)->expanded = (filelist->down)->selected = FALSE; 903 903 904 mr_asprintf( &command_to_open_fname, "gzip -dc %s", filelist_fname);904 mr_asprintf(command_to_open_fname, "gzip -dc %s", filelist_fname); 905 905 if (!(pin = popen(command_to_open_fname, "r"))) { 906 906 log_OS_error("Unable to openin filelist_fname"); … … 1284 1284 bool in_quotes = FALSE; 1285 1285 1286 mr_asprintf( &sz_res, "%s", incoming);1286 mr_asprintf(sz_res, "%s", incoming); 1287 1287 p = sz_res; 1288 1288 while ((*p != '|' || in_quotes) && *p != '\0') { … … 1352 1352 } 1353 1353 } 1354 mr_asprintf( &find_excludes, " ");1354 mr_asprintf(find_excludes, " "); 1355 1355 1356 1356 if (!depth) { … … 1370 1370 #if linux 1371 1371 // 2.6 has /sys as a proc-type thing -- must be excluded 1372 mr_asprintf( &strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype devtmpfs -prune -o -fstype proc -prune -o -fstype selinuxfs -prune -o -fstype securityfs -prune -o -fstype hugetlbfs -o -fstype cgroup -prune -prune -o -fstype mqueue -prune -o -fstype debugfs -prune -o -fstype sysfs -prune -o -fstype rpc_pipefs -prune -o -fstype none -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);1372 mr_asprintf(strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype devtmpfs -prune -o -fstype proc -prune -o -fstype selinuxfs -prune -o -fstype securityfs -prune -o -fstype hugetlbfs -o -fstype cgroup -prune -prune -o -fstype mqueue -prune -o -fstype debugfs -prune -o -fstype sysfs -prune -o -fstype rpc_pipefs -prune -o -fstype none -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist); 1373 1373 #else 1374 1374 // On BSD, for example, /sys is the kernel sources -- don't exclude 1375 mr_asprintf( &strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);1375 mr_asprintf(strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist); 1376 1376 #endif 1377 1377 paranoid_free(find_excludes); … … 1379 1379 paranoid_system(strtmp); 1380 1380 paranoid_free(strtmp); 1381 mr_asprintf( &tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);1381 mr_asprintf(tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist); 1382 1382 g_skeleton_entries = 1383 1383 1 + atol(call_program_and_get_last_line_of_output(tmp)); … … 1411 1411 int cols, rows; 1412 1412 newtGetScreenSize(&cols, &rows); 1413 mr_asprintf( &tmp, "Reading %-*s", cols, dir1);1413 mr_asprintf(tmp, "Reading %-*s", cols, dir1); 1414 1414 newtDrawRootText(0, g_noof_rows - 3, tmp); 1415 1415 mr_free(tmp); … … 1424 1424 1425 1425 // log_msg(0, "Cataloguing %s", dir); 1426 mr_asprintf( &skip_these, "|%s|", sth);1426 mr_asprintf(skip_these, "|%s|", sth); 1427 1427 1428 mr_asprintf( &new_with_pipe, "|%s|", dir1);1428 mr_asprintf(new_with_pipe, "|%s|", dir1); 1429 1429 if ((dip = opendir(dir1)) == NULL) { 1430 mr_asprintf( &tmp,"opendir %s", dir1);1430 mr_asprintf(tmp,"opendir %s", dir1); 1431 1431 log_OS_error(tmp); 1432 1432 paranoid_free(tmp); … … 1440 1440 i++; 1441 1441 if (strcmp(dir1, "/")) { 1442 mr_asprintf( &new,"%s/%s",dir1,dit->d_name);1442 mr_asprintf(new,"%s/%s",dir1,dit->d_name); 1443 1443 } else { 1444 mr_asprintf( &new,"%s%s",dir1,dit->d_name);1444 mr_asprintf(new,"%s%s",dir1,dit->d_name); 1445 1445 } 1446 1446 paranoid_free(new_with_pipe); 1447 mr_asprintf( &new_with_pipe, "|%s|", new);1447 mr_asprintf(new_with_pipe, "|%s|", new); 1448 1448 if (strstr(skip_these, new_with_pipe)) { 1449 1449 fprintf(fout, "%s\n", new); … … 1467 1467 counter = 0; 1468 1468 uberctr++; 1469 mr_asprintf( &tmp, " %c ", special_dot_char(uberctr));1469 mr_asprintf(tmp, " %c ", special_dot_char(uberctr)); 1470 1470 #ifndef _XWIN 1471 1471 if (!g_text_mode) { … … 1536 1536 malloc_string(tmp); 1537 1537 malloc_string(g_skeleton_filelist); 1538 mr_asprintf( &sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);1538 mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0); 1539 1539 if (!include_paths && !userdef_filelist) { 1540 1540 fatal_error … … 1542 1542 } 1543 1543 // make hole for filelist 1544 mr_asprintf( &command, "mkdir -p %s/archives", scratchdir);1544 mr_asprintf(command, "mkdir -p %s/archives", scratchdir); 1545 1545 paranoid_system(command); 1546 1546 mr_free(command); 1547 1547 1548 mr_asprintf( &sz_filelist, "%s/tmpfs/filelist.full", tmpdir);1548 mr_asprintf(sz_filelist, "%s/tmpfs/filelist.full", tmpdir); 1549 1549 make_hole_for_file(sz_filelist); 1550 1550 1551 1551 if (differential == 0) { 1552 1552 // restore last good datefile if it exists 1553 mr_asprintf( &command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);1553 mr_asprintf(command, "cp -f %s.aborted %s", sz_datefile, sz_datefile); 1554 1554 run_program_and_log_output(command, 3); 1555 1555 mr_free(command); … … 1557 1557 // backup last known good datefile just in case :) 1558 1558 if (does_file_exist(sz_datefile)) { 1559 mr_asprintf( &command, "mv -f %s %s.aborted", sz_datefile,1559 mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile, 1560 1560 sz_datefile); 1561 1561 paranoid_system(command); … … 1582 1582 "Using the user-specified filelist - %s - instead of calculating one", 1583 1583 userdef_filelist); 1584 mr_asprintf( &command, "cp -f %s %s", userdef_filelist, sz_filelist);1584 mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist); 1585 1585 if (run_program_and_log_output(command, 3)) { 1586 1586 mr_free(command); … … 1591 1591 log_msg(2, "include_paths = '%s'", include_paths); 1592 1592 log_msg(1, "Calculating filelist"); 1593 mr_asprintf( &tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));1593 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'")); 1594 1594 if (strlen(tmp2) < 1) { 1595 mr_asprintf( &tmp1," ");1595 mr_asprintf(tmp1," "); 1596 1596 } else { 1597 1597 log_msg(2, "Found windows FS: %s",tmp2); 1598 mr_asprintf( &tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);1598 mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2); 1599 1599 paranoid_free(tmp2); 1600 mr_asprintf( &tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));1600 mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1)); 1601 1601 log_msg(2, "Found windows files: %s",tmp2); 1602 1602 } 1603 1603 paranoid_free(tmp1); 1604 1604 1605 mr_asprintf( &exclude_paths, MONDO_CACHE"|%s|%s|%s|.|..|"MNT_CDROM"|"MNT_FLOPPY"|/media|/tmp|/proc|/sys|/run|/dev/shm|"MINDI_CACHE, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);1605 mr_asprintf(exclude_paths, MONDO_CACHE"|%s|%s|%s|.|..|"MNT_CDROM"|"MNT_FLOPPY"|/media|/tmp|/proc|/sys|/run|/dev/shm|"MINDI_CACHE, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir); 1606 1606 if (excp != NULL) { 1607 1607 mr_strcat(exclude_paths,"|%s",excp); … … 1640 1640 } 1641 1641 log_msg(2, "Copying new filelist to scratchdir"); 1642 mr_asprintf( &command, "mkdir -p %s/archives", scratchdir);1642 mr_asprintf(command, "mkdir -p %s/archives", scratchdir); 1643 1643 paranoid_system(command); 1644 1644 mr_free(command); 1645 1645 1646 mr_asprintf( &command, "cp -f %s %s/archives/", sz_filelist, scratchdir);1646 mr_asprintf(command, "cp -f %s %s/archives/", sz_filelist, scratchdir); 1647 1647 paranoid_system(command); 1648 1648 mr_free(command); 1649 1649 1650 mr_asprintf( &command, "mv -f %s %s", sz_filelist, tmpdir);1650 mr_asprintf(command, "mv -f %s %s", sz_filelist, tmpdir); 1651 1651 paranoid_system(command); 1652 1652 mr_free(command); -
branches/3.0/mondo/src/common/libmondo-fork.c
r3060 r3185 134 134 135 135 if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) { 136 mr_asprintf( &tmp1, "su - %s -c \"%s\"", bkpinfo->netfs_user, basic_call);136 mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->netfs_user, basic_call); 137 137 } else { 138 mr_asprintf( &tmp1, "%s", basic_call);138 mr_asprintf(tmp1, "%s", basic_call); 139 139 } 140 140 … … 285 285 log_if_failure = TRUE; 286 286 } 287 mr_asprintf( &callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);287 mr_asprintf(callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir); 288 288 while ((p = strchr(callstr, '\r'))) { 289 289 *p = ' '; … … 301 301 mr_free(callstr); 302 302 303 mr_asprintf( &callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);303 mr_asprintf(callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir); 304 304 if (log_if_failure && system(callstr)) { 305 305 log_OS_error("Command failed"); … … 307 307 mr_free(callstr); 308 308 309 mr_asprintf( &tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);309 mr_asprintf(tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir); 310 310 unlink(tmp1); 311 311 mr_free(tmp1); 312 312 313 mr_asprintf( &tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);313 mr_asprintf(tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir); 314 314 fin = fopen(tmp1, "r"); 315 315 if (fin) { … … 378 378 sprintf(lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir); 379 379 380 mr_asprintf( &command,380 mr_asprintf(command, 381 381 "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res", 382 382 lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile); 383 383 open_evalcall_form(what_i_am_doing); 384 mr_asprintf( &tmp, "Executing %s", basic_call);384 mr_asprintf(tmp, "Executing %s", basic_call); 385 385 log_msg(2, tmp); 386 386 mr_free(tmp); … … 388 388 if (!(fin = popen(command, "r"))) { 389 389 log_OS_error("Unable to popen-in command"); 390 mr_asprintf( &tmp, "Failed utterly to call '%s'", command);390 mr_asprintf(tmp, "Failed utterly to call '%s'", command); 391 391 log_to_screen(tmp); 392 392 mr_free(tmp); -
branches/3.0/mondo/src/common/libmondo-mountlist.c
r3060 r3185 72 72 /*@ initialize ***************************************************** */ 73 73 prev_part_no = 0; 74 mr_asprintf( &flaws_str, "%s", "");74 mr_asprintf(flaws_str, "%s", ""); 75 75 76 76 … … 78 78 79 79 if (physical_drive_size < 0) { 80 mr_asprintf( &tmp, " %s does not exist.", drive);80 mr_asprintf(tmp, " %s does not exist.", drive); 81 81 mr_strcat(flaws_str, "%s", tmp); 82 82 } else { 83 mr_asprintf( &tmp, "%s is %ld MB", drive, physical_drive_size);83 mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size); 84 84 } 85 85 log_it(tmp); … … 103 103 /* is it too big? */ 104 104 if (curr_part_no > 'h') { 105 mr_asprintf( &tmp, " Can only have up to 'h' in disklabel.");105 mr_asprintf(tmp, " Can only have up to 'h' in disklabel."); 106 106 log_it(tmp); 107 107 mr_strcat(flaws_str, tmp); … … 117 117 } 118 118 if (device_copies > 1) { 119 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);119 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 120 120 if (!strstr(flaws_str, tmp)) { 121 121 log_it(tmp); … … 128 128 if (mountlist->el[pos].size < 8192 129 129 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 130 mr_asprintf( &tmp, " %s is tiny!", device);130 mr_asprintf(tmp, " %s is tiny!", device); 131 131 log_it(tmp); 132 132 mr_strcat(flaws_str, tmp); … … 141 141 && strcmp(mountlist->el[pos].mountpoint, "none") 142 142 && mountlist->el[pos].mountpoint[0] != '/') { 143 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);143 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 144 144 log_it(tmp); 145 145 mr_strcat(flaws_str, tmp); … … 149 149 /* is format sensible? */ 150 150 if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) { 151 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);151 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 152 152 log_it(tmp); 153 153 mr_strcat(flaws_str, tmp); … … 181 181 if (curr_part_no - prev_part_no > 1) { 182 182 if (prev_part_no == 0) { 183 mr_asprintf( &tmp, " Gap prior to %s.", device);183 mr_asprintf(tmp, " Gap prior to %s.", device); 184 184 log_it(tmp); 185 185 mr_strcat(flaws_str, "%s", tmp); … … 188 188 } else if (curr_part_no > 5 189 189 || (curr_part_no <= 4 && prev_part_no > 0)) { 190 mr_asprintf( &tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no);190 mr_asprintf(tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no); 191 191 log_it(tmp); 192 192 mr_strcat(flaws_str, "%s", tmp); … … 200 200 if ((curr_part_no >= 5 && prev_part_no == 4) 201 201 && (strcmp(part_table_fmt, "MBR") == 0)) { 202 mr_asprintf( &tmp, " Partition %ss4 is occupied.", drive);202 mr_asprintf(tmp, " Partition %ss4 is occupied.", drive); 203 203 log_it(tmp); 204 204 mr_strcat(flaws_str, "%s", tmp); … … 214 214 } 215 215 if (device_copies > 1) { 216 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);216 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 217 217 if (!strstr(flaws_str, "%s", tmp)) { 218 218 log_it(tmp); … … 225 225 if (mountlist->el[pos].size < 8192 226 226 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 227 mr_asprintf( &tmp, " %s is tiny!", device);227 mr_asprintf(tmp, " %s is tiny!", device); 228 228 log_it(tmp); 229 229 mr_strcat(flaws_str, "%s", tmp); … … 238 238 && strcmp(mountlist->el[pos].mountpoint, "none") 239 239 && mountlist->el[pos].mountpoint[0] != '/') { 240 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);240 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 241 241 log_it(tmp); 242 242 mr_strcat(flaws_str, "%s", tmp); … … 246 246 /* is format sensible? */ 247 247 if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) { 248 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);248 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 249 249 log_it(tmp); 250 250 mr_strcat(flaws_str, "%s", tmp); … … 263 263 /* is it too big? */ 264 264 if (curr_part_no > 'h') { 265 mr_asprintf( &tmp, " Can only have up to 'h' in disklabel.");265 mr_asprintf(tmp, " Can only have up to 'h' in disklabel."); 266 266 log_it(tmp); 267 267 mr_strcat(flaws_str, "%s", tmp); … … 277 277 } 278 278 if (device_copies > 1) { 279 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);279 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 280 280 if (!strstr(flaws_str, tmp)) { 281 281 log_it(tmp); … … 288 288 if (mountlist->el[pos].size < 8192 289 289 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 290 mr_asprintf( &tmp, " %s is tiny!", device);290 mr_asprintf(tmp, " %s is tiny!", device); 291 291 log_it(tmp); 292 292 mr_strcat(flaws_str, "%s", tmp); … … 301 301 && strcmp(mountlist->el[pos].mountpoint, "none") 302 302 && mountlist->el[pos].mountpoint[0] != '/') { 303 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);303 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 304 304 log_it(tmp); 305 305 mr_strcat(flaws_str, "%s", tmp); … … 310 310 if (!is_this_a_valid_disk_format 311 311 (mountlist->el[pos].format)) { 312 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);312 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 313 313 log_it(tmp); 314 314 mr_strcat(flaws_str, "%s", tmp); … … 327 327 if (amount_allocated > physical_drive_size) { 328 328 // Used to be +1, but what if you're 1 MB too high? 329 mr_asprintf( &tmp, " %ld MB over-allocated on %s.",329 mr_asprintf(tmp, " %ld MB over-allocated on %s.", 330 330 amount_allocated - physical_drive_size, drive); 331 331 log_it(tmp); … … 349 349 /* Over-allocated the disk? Unallocated space on disk? */ 350 350 if (amount_allocated < physical_drive_size - 1) { /* NOT AN ERROR, JUST A WARNING :-) */ 351 mr_asprintf( &tmp, " %ld MB unallocated on %s.",351 mr_asprintf(tmp, " %ld MB unallocated on %s.", 352 352 physical_drive_size - amount_allocated, drive); 353 353 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 malloc_string(device); … … 398 398 if (physical_drive_size < 0) { 399 399 if (strstr(drive,"/dev/dm-") == NULL) { 400 mr_asprintf( &tmp, " %s does not exist.", drive);400 mr_asprintf(tmp, " %s does not exist.", drive); 401 401 log_it(tmp); 402 402 mr_strcat(flaws_str, "%s", tmp); … … 405 405 goto endoffunc; 406 406 } else { 407 mr_asprintf( &tmp, " %s (dm) will be setup later on", drive);407 mr_asprintf(tmp, " %s (dm) will be setup later on", drive); 408 408 log_it(tmp); 409 409 mr_free(tmp); 410 410 } 411 411 } else { 412 mr_asprintf( &tmp, "%s is %ld MB", drive, physical_drive_size);412 mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size); 413 413 log_it(tmp); 414 414 mr_free(tmp); … … 425 425 if (curr_part_no - prev_part_no > 1) { 426 426 if (prev_part_no == 0) { 427 mr_asprintf( &tmp, " Gap prior to %s.", device);427 mr_asprintf(tmp, " Gap prior to %s.", device); 428 428 log_it(tmp); 429 429 mr_strcat(flaws_str, "%s", tmp); … … 432 432 } else if (curr_part_no > 5 433 433 || (curr_part_no <= 4 && prev_part_no > 0)) { 434 mr_asprintf( &tmp, " Gap on %s between %d and %d.", drive,434 mr_asprintf(tmp, " Gap on %s between %d and %d.", drive, 435 435 prev_part_no, curr_part_no); 436 436 log_it(tmp); … … 445 445 if ((curr_part_no >= 5 && prev_part_no == 4) 446 446 && (strcmp(part_table_fmt, "MBR") == 0)) { 447 mr_asprintf( &tmp, " Partition 4 of %s is occupied.", drive);447 mr_asprintf(tmp, " Partition 4 of %s is occupied.", drive); 448 448 log_it(tmp); 449 449 mr_strcat(flaws_str, "%s", tmp); … … 459 459 } 460 460 if (device_copies > 1) { 461 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies),461 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), 462 462 device); 463 463 if (!strstr(flaws_str, tmp)) { … … 471 471 if (mountlist->el[pos].size < 8192 472 472 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 473 mr_asprintf( &tmp, " %s is tiny!", device);473 mr_asprintf(tmp, " %s is tiny!", device); 474 474 log_it(tmp); 475 475 mr_strcat(flaws_str, "%s", tmp); … … 483 483 && strcmp(mountlist->el[pos].mountpoint, "image") 484 484 && mountlist->el[pos].mountpoint[0] != '/') { 485 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);485 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 486 486 log_it(tmp); 487 487 mr_strcat(flaws_str, "%s", tmp); … … 491 491 /* is format sensible? */ 492 492 if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) { 493 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);493 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 494 494 log_it(tmp); 495 495 mr_strcat(flaws_str, "%s", tmp); … … 504 504 /* Over-allocated the disk? Unallocated space on disk? */ 505 505 if (amount_allocated > physical_drive_size + 1) { 506 mr_asprintf( &tmp, " %ld MB over-allocated on %s.",506 mr_asprintf(tmp, " %ld MB over-allocated on %s.", 507 507 amount_allocated - physical_drive_size, drive); 508 508 log_it(tmp); … … 511 511 res++; 512 512 } else if (amount_allocated < physical_drive_size - 1) { /* NOT AN ERROR, JUST A WARNING :-) */ 513 mr_asprintf( &tmp, " %ld MB unallocated on %s.",513 mr_asprintf(tmp, " %ld MB unallocated on %s.", 514 514 physical_drive_size - amount_allocated, drive); 515 515 log_it(tmp); … … 570 570 (drivelist->el[i].device, 571 571 DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE)) { 572 mr_asprintf( &tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device);572 mr_asprintf(tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device); 573 573 log_it(tmp); 574 574 paranoid_free(tmp); … … 588 588 /* Look for duplicate mountpoints in mountlist. */ 589 589 for (currline = 0; currline < mountlist->entries; currline++) { 590 mr_asprintf( &curr_mountpoint, "%s", mountlist->el[currline].mountpoint);590 mr_asprintf(curr_mountpoint, "%s", mountlist->el[currline].mountpoint); 591 591 for (i = 0, copies = 0, last_copy = -1; i < mountlist->entries; i++) { 592 592 if (!strcmp(mountlist->el[i].mountpoint, curr_mountpoint) … … 599 599 if (copies > 1 && last_copy == currline 600 600 && strcmp(curr_mountpoint, "raid")) { 601 mr_asprintf( &tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);601 mr_asprintf(tmp, " %s %s's.", number_to_text(copies), curr_mountpoint); 602 602 mr_strcat(flaws_str, "%s", tmp); 603 603 log_msg(8,"Adding: %s to flaws_str", tmp); … … 666 666 for (lino = 0, noof_drives = 0; lino < mountlist->entries; lino++) { 667 667 668 mr_asprintf( &drive, "%s", mountlist->el[lino].device);668 mr_asprintf(drive, "%s", mountlist->el[lino].device); 669 669 if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) { 670 670 log_msg(8, "Not putting %s in list of drives: it's a virtual drive", drive); … … 753 753 (void *) &mountlist->el[i], 754 754 sizeof(struct mountlist_line)); 755 mr_asprintf( &tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);755 mr_asprintf(tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device); 756 756 log_it(tmp); 757 757 paranoid_free(tmp); … … 874 874 if (j < items) { 875 875 strcat(mountlist->el[items].device, "_dup"); 876 mr_asprintf( &tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);876 mr_asprintf(tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device); 877 877 log_it(tmp); 878 878 paranoid_free(tmp); 879 879 } 880 mr_asprintf( &tmp, "%s", mountlist->el[items].device);880 mr_asprintf(tmp, "%s", mountlist->el[items].device); 881 881 if (strstr(tmp, "/dev/md/")) { 882 882 log_it("format_device() --- Contracting %s", tmp); … … 1033 1033 assert(b >= 0); 1034 1034 1035 mr_asprintf( &device, "%s", mountlist->el[a].device);1036 mr_asprintf( &mountpoint, "%s", mountlist->el[a].mountpoint);1037 mr_asprintf( &format, "%s", mountlist->el[a].format);1035 mr_asprintf(device, "%s", mountlist->el[a].device); 1036 mr_asprintf(mountpoint, "%s", mountlist->el[a].mountpoint); 1037 mr_asprintf(format, "%s", mountlist->el[a].format); 1038 1038 1039 1039 size = mountlist->el[a].size; -
branches/3.0/mondo/src/common/libmondo-raid.c
r3154 r3185 51 51 int res; 52 52 53 mr_asprintf( &command, "grep \"");53 mr_asprintf(command, "grep \""); 54 54 if (raidno == -1) { 55 55 mr_strcat(command, "linear"); … … 198 198 assert(label != NULL); 199 199 200 mr_asprintf( &sz_value, "%d", value);200 mr_asprintf(sz_value, "%d", value); 201 201 strcpy(raidrec->additional_vars.el[lino].label, label); 202 202 strcpy(raidrec->additional_vars.el[lino].value, sz_value); … … 587 587 fclose(fin); 588 588 log_it("Raidtab loaded successfully."); 589 mr_asprintf( &tmp1, "%d RAID devices in raidtab", raidlist->entries);589 mr_asprintf(tmp1, "%d RAID devices in raidtab", raidlist->entries); 590 590 log_it(tmp1); 591 591 mr_free(tmp1); … … 739 739 } 740 740 if (!disklist) { 741 mr_asprintf( &tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label);741 mr_asprintf(tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label); 742 742 log_it(tmp); 743 743 mr_free(tmp); … … 1032 1032 } 1033 1033 // get RAID device name 1034 mr_asprintf( &strtmp,"%s%s", device_prefix, token);1034 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1035 1035 strncpy(raidlist->el[raidlist->entries].raid_device, strtmp, 63); 1036 1036 raidlist->el[raidlist->entries].raid_device[63] = '\0'; … … 1040 1040 v = raidlist->el[raidlist->entries].additional_vars.entries; 1041 1041 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].label, "UUID"); 1042 mr_asprintf( &cmd,"mdadm --detail %s | grep UUID | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device);1043 mr_asprintf( &strtmp, "%s", call_program_and_get_last_line_of_output(cmd));1042 mr_asprintf(cmd,"mdadm --detail %s | grep UUID | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device); 1043 mr_asprintf(strtmp, "%s", call_program_and_get_last_line_of_output(cmd)); 1044 1044 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].value, strtmp); 1045 1045 mr_free(strtmp); … … 1047 1047 // store the Version value in the additional_vars structure 1048 1048 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].label, "Version"); 1049 mr_asprintf( &cmd,"mdadm --detail %s | grep Version | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device);1050 mr_asprintf( &strtmp, "%s", call_program_and_get_last_line_of_output(cmd));1049 mr_asprintf(cmd,"mdadm --detail %s | grep Version | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device); 1050 mr_asprintf(strtmp, "%s", call_program_and_get_last_line_of_output(cmd)); 1051 1051 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].value, strtmp); 1052 1052 mr_free(strtmp); … … 1128 1128 case ' ': // normal data disks 1129 1129 raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].index = atoi(pos + 1); 1130 mr_asprintf( &strtmp,"%s%s", device_prefix, token);1130 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1131 1131 strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp); 1132 1132 mr_free(strtmp); … … 1135 1135 case 'S': // spare disks 1136 1136 raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].index = atoi(pos + 1); 1137 mr_asprintf( &strtmp,"%s%s", device_prefix, token);1137 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1138 1138 strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp); 1139 1139 mr_free(strtmp); … … 1142 1142 case 'F': // failed disks 1143 1143 raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].index = atoi(pos + 1); 1144 mr_asprintf( &strtmp,"%s%s", device_prefix, token);1144 mr_asprintf(strtmp,"%s%s", device_prefix, token); 1145 1145 strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp); 1146 1146 mr_free(strtmp); -
branches/3.0/mondo/src/common/libmondo-stream.c
r3150 r3185 242 242 int res; 243 243 244 mr_asprintf( &command, "mt -f %s status", dev);244 mr_asprintf(command, "mt -f %s status", dev); 245 245 res = run_program_and_log_output(command, 1); 246 246 mr_free(command); … … 276 276 strcpy(cdr_exe, "dvdrecord"); 277 277 } 278 mr_asprintf( &command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l",278 mr_asprintf(command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", 279 279 cdr_exe); 280 280 strcpy(tmp, call_program_and_get_last_line_of_output(command)); … … 287 287 return 1; 288 288 } 289 mr_asprintf( &command,289 mr_asprintf(command, 290 290 "%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", 291 291 cdr_exe); … … 297 297 return 1; 298 298 } 299 mr_asprintf( &command,299 mr_asprintf(command, 300 300 "%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", 301 301 cdr_exe); … … 383 383 } 384 384 if (strstr(fname, "xattr") == NULL) { 385 mr_asprintf( &tmp,"Wrong order expected xattr, got %s, sunshine.", fname);385 mr_asprintf(tmp,"Wrong order expected xattr, got %s, sunshine.", fname); 386 386 fatal_error(tmp); 387 387 } … … 413 413 } 414 414 if (strstr(fname, "acl") == NULL) { 415 mr_asprintf( &tmp,"Wrong order expected acl, got %s, sunshine.", fname);415 mr_asprintf(tmp,"Wrong order expected acl, got %s, sunshine.", fname); 416 416 fatal_error(tmp); 417 417 } … … 479 479 log_it("Insisting on tape #%d", tapeno); 480 480 if (g_current_media_number != tapeno) { 481 mr_asprintf( &tmp,481 mr_asprintf(tmp, 482 482 "When the tape drive goes quiet, please insert volume %d in this series.", 483 483 tapeno); … … 549 549 suffix[0] = '\0'; 550 550 } 551 mr_asprintf( &tmpdir, "%s/tmpfs/backcatalog", td);551 mr_asprintf(tmpdir, "%s/tmpfs/backcatalog", td); 552 552 mkdir(tmpdir, 0x700); 553 mr_asprintf( &command, "cp -f %s %s", latest_fname, tmpdir);553 mr_asprintf(command, "cp -f %s %s", latest_fname, tmpdir); 554 554 if (run_program_and_log_output(command, 6)) { 555 555 log_it("Warning - failed to copy %s to backcatalog at %s", … … 579 579 580 580 for (i = curr - 1; i >= 0 && curr - i < 10; i--) { 581 mr_asprintf( &old_fname, "%s/%s", tmpdir, g_tapecatalog->el[i].fname);581 mr_asprintf(old_fname, "%s/%s", tmpdir, g_tapecatalog->el[i].fname); 582 582 unlink(old_fname); 583 583 mr_free(old_fname); … … 619 619 return (0); 620 620 } 621 mr_asprintf( &tmp, "mt -f %s setblk %ld", bkpinfo->media_device, internal_tape_block_size);621 mr_asprintf(tmp, "mt -f %s setblk %ld", bkpinfo->media_device, internal_tape_block_size); 622 622 res = run_program_and_log_output(tmp, 3); 623 623 mr_free(tmp); … … 688 688 689 689 log_it("Skipping OBDR headers"); 690 mr_asprintf( &command, "mt -f %s rewind",bkpinfo->media_device);690 mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device); 691 691 res = run_program_and_log_output(command, 1); 692 692 paranoid_free(command); 693 693 694 mr_asprintf( &command, "mt -f %s fsf 2",bkpinfo->media_device);694 mr_asprintf(command, "mt -f %s fsf 2",bkpinfo->media_device); 695 695 res = run_program_and_log_output(command, 1); 696 696 paranoid_free(command); … … 715 715 log_it("Creating OBDR headers"); 716 716 /* OBDR: First block 10 kB of zero bs = 512 */ 717 mr_asprintf( &command, "mt -f %s compression off",bkpinfo->media_device);717 mr_asprintf(command, "mt -f %s compression off",bkpinfo->media_device); 718 718 res = run_program_and_log_output(command, 1); 719 719 paranoid_free(command); 720 720 721 mr_asprintf( &command, "mt -f %s rewind",bkpinfo->media_device);721 mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device); 722 722 res += run_program_and_log_output(command, 1); 723 723 paranoid_free(command); … … 725 725 set_tape_block_size_with_mt(512); 726 726 727 mr_asprintf( &command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device);727 mr_asprintf(command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device); 728 728 res += run_program_and_log_output(command, 1); 729 729 paranoid_free(command); … … 732 732 set_tape_block_size_with_mt(2048); 733 733 734 mr_asprintf( &command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device);734 mr_asprintf(command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device); 735 735 res += run_program_and_log_output(command, 1); 736 736 paranoid_free(command); … … 739 739 740 740 /* restore compression mode on */ 741 mr_asprintf( &command, "mt -f %s compression on",bkpinfo->media_device);741 mr_asprintf(command, "mt -f %s compression on",bkpinfo->media_device); 742 742 res = run_program_and_log_output(command, 1); 743 743 paranoid_free(command); … … 805 805 806 806 insist_on_this_tape_number(1); 807 mr_asprintf( &outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);807 mr_asprintf(outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir); 808 808 make_hole_for_file(outfname); 809 809 … … 874 874 // FIXME 875 875 } 876 mr_asprintf( &tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null",876 mr_asprintf(tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", 877 877 outfname); 878 878 paranoid_system(tmp); … … 904 904 905 905 /* add 'dummy' if testing */ 906 mr_asprintf( &command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE);906 mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE); 907 907 /* initialise the catalog */ 908 908 g_current_media_number = 1; … … 1078 1078 } 1079 1079 if (orig_size != temp_size && orig_size != -1) { 1080 mr_asprintf( &tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);1080 mr_asprintf(tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10); 1081 1081 log_to_screen(tmp); 1082 1082 mr_free(tmp); … … 1141 1141 log_msg(6, ".......................... Should be %lld", orig_size); 1142 1142 g_tape_posK += total_read_from_tape_for_this_file / 1024; 1143 mr_asprintf( &actual_cksum, "%04x%04x", crc16, crctt);1143 mr_asprintf(actual_cksum, "%04x%04x", crc16, crctt); 1144 1144 if (foutstream) { /*log_it("Finished writing to foutstream"); */ 1145 1145 } else { … … 1151 1151 } 1152 1152 if (strcmp(temp_cksum, actual_cksum)) { 1153 mr_asprintf( &tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum,1153 mr_asprintf(tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, 1154 1154 temp_cksum); 1155 1155 log_to_screen(tmp); 1156 1156 mr_free(tmp); 1157 1157 1158 mr_asprintf( &tmp, "%s (%ld K) is corrupt on tape", temp_fname,1158 mr_asprintf(tmp, "%s (%ld K) is corrupt on tape", temp_fname, 1159 1159 (long) orig_size >> 10); 1160 1160 log_to_screen(tmp); … … 1494 1494 insist_on_this_tape_number(g_current_media_number + 1); // will increment g_current_media, too 1495 1495 if (bkpinfo->backup_media_type == cdstream) { 1496 mr_asprintf( &command,1496 mr_asprintf(command, 1497 1497 "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", 1498 1498 bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE, … … 1549 1549 last = g_tapecatalog->entries - 1; 1550 1550 for (i = 0; i <= last; i++) { 1551 mr_asprintf( &fname, "%s/tmpfs/backcatalog/%s", bkpinfo->tmpdir, g_tapecatalog->el[i].fname);1551 mr_asprintf(fname, "%s/tmpfs/backcatalog/%s", bkpinfo->tmpdir, g_tapecatalog->el[i].fname); 1552 1552 if (!does_file_exist(fname)) { 1553 1553 log_msg(6, "Can't write %s - it doesn't exist.", fname); … … 1602 1602 log_it("Data disks = %s", fname); 1603 1603 if (!does_file_exist(fname)) { 1604 mr_asprintf( &tmp, "Cannot find %s", fname);1604 mr_asprintf(tmp, "Cannot find %s", fname); 1605 1605 log_to_screen(tmp); 1606 1606 mr_free(tmp); … … 1700 1700 p++; 1701 1701 } 1702 mr_asprintf( &tmp, "Writing file '%s' to tape (%ld KB)", p,1702 mr_asprintf(tmp, "Writing file '%s' to tape (%ld KB)", p, 1703 1703 (long) filesize >> 10); 1704 1704 log_it(tmp); … … 1745 1745 } 1746 1746 paranoid_fclose(fin); 1747 mr_asprintf( &checksum, "%04x%04x", crc16, crctt);1747 mr_asprintf(checksum, "%04x%04x", crc16, crctt); 1748 1748 /* BERLIOS: what does it do ??? */ 1749 1749 write_header_block_to_stream((off_t)g_current_media_number, checksum, BLK_STOP_FILE); … … 1808 1808 fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE, 1809 1809 g_tape_stream) / 1024; 1810 mr_asprintf( &tmp, "%s (fname=%s, size=%ld K)",1810 mr_asprintf(tmp, "%s (fname=%s, size=%ld K)", 1811 1811 marker_to_string(control_char), p, 1812 1812 (long) length_of_incoming_file >> 10); … … 1837 1837 1838 1838 /*@ end vars *************************************************** */ 1839 mr_asprintf( &tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));1839 mr_asprintf(tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is)); 1840 1840 log_to_screen(tmp); 1841 1841 mr_free(tmp); -
branches/3.0/mondo/src/common/libmondo-string.c
r3150 r3185 817 817 818 818 assert_string_is_neither_NULL_nor_zerolength(partition); 819 mr_asprintf( &trunc, "%s", partition);819 mr_asprintf(trunc, "%s", partition); 820 820 821 821 #ifdef __FreeBSD__ … … 1122 1122 switch (type_of_bkp) { 1123 1123 case dvd: 1124 mr_asprintf( &type_of_backup, "DVD");1124 mr_asprintf(type_of_backup, "DVD"); 1125 1125 break; 1126 1126 case cdr: 1127 mr_asprintf( &type_of_backup, "CDR");1127 mr_asprintf(type_of_backup, "CDR"); 1128 1128 break; 1129 1129 case cdrw: 1130 mr_asprintf( &type_of_backup, "CDRW");1130 mr_asprintf(type_of_backup, "CDRW"); 1131 1131 break; 1132 1132 case tape: 1133 mr_asprintf( &type_of_backup, "tape");1133 mr_asprintf(type_of_backup, "tape"); 1134 1134 break; 1135 1135 case cdstream: 1136 mr_asprintf( &type_of_backup, "CDR");1136 mr_asprintf(type_of_backup, "CDR"); 1137 1137 break; 1138 1138 case udev: 1139 mr_asprintf( &type_of_backup, "udev");1139 mr_asprintf(type_of_backup, "udev"); 1140 1140 break; 1141 1141 case iso: 1142 mr_asprintf( &type_of_backup, "ISO");1142 mr_asprintf(type_of_backup, "ISO"); 1143 1143 break; 1144 1144 case netfs: 1145 mr_asprintf( &type_of_backup, "%s", bkpinfo->netfs_proto);1145 mr_asprintf(type_of_backup, "%s", bkpinfo->netfs_proto); 1146 1146 break; 1147 1147 case usb: 1148 mr_asprintf( &type_of_backup, "USB");1148 mr_asprintf(type_of_backup, "USB"); 1149 1149 break; 1150 1150 default: 1151 mr_asprintf( &type_of_backup, "ISO");1151 mr_asprintf(type_of_backup, "ISO"); 1152 1152 } 1153 1153 return (type_of_backup); -
branches/3.0/mondo/src/common/libmondo-tools.c
r3154 r3185 224 224 225 225 uname(&utsn); 226 mr_asprintf( &tmp, "%s", utsn.machine);226 mr_asprintf(tmp, "%s", utsn.machine); 227 227 return (tmp); 228 228 } … … 400 400 } 401 401 log_msg(1, "Tape"); 402 mr_asprintf( &tmp, "mt -f %s status", bkpinfo->media_device);402 mr_asprintf(tmp, "mt -f %s status", bkpinfo->media_device); 403 403 log_msg(1, "tmp = '%s'", tmp); 404 404 if (run_program_and_log_output(tmp, 3)) { … … 446 446 } 447 447 if (bkpinfo->nonbootable_backup) { 448 mr_asprintf( &mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);448 mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT); 449 449 } else if 450 450 #ifdef __FreeBSD__ … … 455 455 #ifdef __IA64__ 456 456 { 457 mr_asprintf( &mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO);457 mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO); 458 458 } 459 459 #else 460 460 { 461 mr_asprintf( &mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO);461 mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO); 462 462 } 463 463 #endif 464 464 else 465 465 { 466 mr_asprintf( &mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX);466 mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX); 467 467 } 468 468 if (bkpinfo->manual_cd_tray) { … … 478 478 } 479 479 if (getenv ("SUDO_COMMAND")) { 480 mr_asprintf( &command, "strings `which growisofs` | grep -c SUDO_COMMAND");480 mr_asprintf(command, "strings `which growisofs` | grep -c SUDO_COMMAND"); 481 481 if (!strcmp(call_program_and_get_last_line_of_output(command), "1")) { 482 482 mr_free(command); … … 494 494 || bkpinfo->backup_media_type == cdr) { 495 495 if (!bkpinfo->manual_cd_tray) { 496 mr_asprintf( &extra_cdrom_params, "-waiti ");496 mr_asprintf(extra_cdrom_params, "-waiti "); 497 497 } 498 498 if (bkpinfo->backup_media_type == cdrw) { 499 mr_asprintf( &extra_cdrom_params, "blank=fast ");499 mr_asprintf(extra_cdrom_params, "blank=fast "); 500 500 } 501 501 if (extra_cdrom_params == NULL) { 502 502 // If not initialized earlier, do it now 503 mr_asprintf( &extra_cdrom_params, " ");503 mr_asprintf(extra_cdrom_params, " "); 504 504 } 505 505 if (find_home_of_exe("cdrecord")) { … … 511 511 } 512 512 if (find_home_of_exe("genisoimage")) { 513 mr_asprintf( &isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD);513 mr_asprintf(isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD); 514 514 } else { 515 mr_asprintf( &isofs_cmd, "%s", MONDO_MKISOFS_CMD);515 mr_asprintf(isofs_cmd, "%s", MONDO_MKISOFS_CMD); 516 516 } 517 517 if (bkpinfo->nonbootable_backup) { 518 mr_asprintf( &mondo_mkisofs_sz, "%s%s", isofs_cmd, MONDO_MKISOFS);518 mr_asprintf(mondo_mkisofs_sz, "%s%s", isofs_cmd, MONDO_MKISOFS); 519 519 } else if 520 520 #ifdef __FreeBSD__ … … 525 525 #ifdef __IA64__ 526 526 { 527 mr_asprintf( &mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_ELILO);527 mr_asprintf(mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_ELILO); 528 528 } 529 529 #else 530 530 { 531 mr_asprintf( &mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_LILO);531 mr_asprintf(mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_LILO); 532 532 } 533 533 #endif 534 534 else 535 535 { 536 mr_asprintf( &mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_SYSLINUX);536 mr_asprintf(mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_SYSLINUX); 537 537 } 538 538 mr_free(isofs_cmd); … … 577 577 578 578 log_it("isodir = %s", bkpinfo->isodir); 579 mr_asprintf( &command, "df -P %s | tail -n1 | cut -d' ' -f1",579 mr_asprintf(command, "df -P %s | tail -n1 | cut -d' ' -f1", 580 580 bkpinfo->isodir); 581 581 log_it("command = %s", command); 582 582 log_it("res of it = %s", call_program_and_get_last_line_of_output(command)); 583 mr_asprintf( &iso_dev, "%s", call_program_and_get_last_line_of_output(command));584 mr_asprintf( &tmp, "%s/ISO-DEV", bkpinfo->tmpdir);583 mr_asprintf(iso_dev, "%s", call_program_and_get_last_line_of_output(command)); 584 mr_asprintf(tmp, "%s/ISO-DEV", bkpinfo->tmpdir); 585 585 write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command)); 586 586 mr_free(tmp); 587 587 mr_free(command); 588 588 589 mr_asprintf( &command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", iso_dev);589 mr_asprintf(command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", iso_dev); 590 590 mr_free(iso_dev); 591 591 592 592 log_it("command = %s", command); 593 593 log_it("res of it = %s", call_program_and_get_last_line_of_output(command)); 594 mr_asprintf( &iso_mnt, "%s", call_program_and_get_last_line_of_output(command));595 mr_asprintf( &tmp, "%s/ISO-MNT", bkpinfo->tmpdir);594 mr_asprintf(iso_mnt, "%s", call_program_and_get_last_line_of_output(command)); 595 mr_asprintf(tmp, "%s/ISO-MNT", bkpinfo->tmpdir); 596 596 write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command)); 597 597 mr_free(tmp); … … 599 599 600 600 log_it("isomnt: %s, %d", iso_mnt, strlen(iso_mnt)); 601 mr_asprintf( &iso_tmp, "%s", bkpinfo->isodir);601 mr_asprintf(iso_tmp, "%s", bkpinfo->isodir); 602 602 if (strlen(iso_tmp) < strlen(iso_mnt)) { 603 mr_asprintf( &iso_path, "%s", "");603 mr_asprintf(iso_path, "%s", ""); 604 604 } else { 605 605 // If iso_mnt is only / then iso_path is the full dir 606 606 // (the formula bellow doesn't work in this case) 607 607 if (strcmp(iso_mnt, "/") == 0) { 608 mr_asprintf( &iso_path, "%s", iso_tmp);608 mr_asprintf(iso_path, "%s", iso_tmp); 609 609 // else it's a part of iso_tmp 610 610 } else { 611 mr_asprintf( &iso_path, "%s", iso_tmp + strlen(iso_mnt));611 mr_asprintf(iso_path, "%s", iso_tmp + strlen(iso_mnt)); 612 612 } 613 613 } … … 615 615 mr_free(iso_mnt); 616 616 617 mr_asprintf( &tmp, "%s/ISODIR", bkpinfo->tmpdir);617 mr_asprintf(tmp, "%s/ISODIR", bkpinfo->tmpdir); 618 618 write_one_liner_data_file(tmp, iso_path); 619 619 mr_free(tmp); … … 622 622 mr_free(iso_path); 623 623 624 mr_asprintf( &tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);624 mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir); 625 625 write_one_liner_data_file(tmp, bkpinfo->prefix); 626 626 mr_free(tmp); … … 646 646 colon++; 647 647 hent = gethostbyname(colon); 648 mr_asprintf( &(bkpinfo->netfs_user),"%s", hostname);648 mr_asprintf(bkpinfo->netfs_user,"%s", hostname); 649 649 } else { 650 650 hent = gethostbyname(hostname); … … 655 655 retval++; 656 656 } else { 657 mr_asprintf( &ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));657 mr_asprintf(ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr))); 658 658 mr_strcat(ip_address, strchr(bkpinfo->netfs_mount, ':')); 659 659 strcpy(bkpinfo->netfs_mount, ip_address); … … 709 709 } 710 710 711 mr_asprintf( &tmp,"rm -Rf %s/changed.files*",MONDO_CACHE);711 mr_asprintf(tmp,"rm -Rf %s/changed.files*",MONDO_CACHE); 712 712 run_program_and_log_output(tmp, FALSE); 713 713 paranoid_free(tmp); … … 750 750 if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) { 751 751 log_it("Purging old tmpdir %s", bkpinfo->tmpdir); 752 mr_asprintf( &tmp,"rm -Rf %s",bkpinfo->tmpdir);752 mr_asprintf(tmp,"rm -Rf %s",bkpinfo->tmpdir); 753 753 } else { 754 754 log_it("Purging old tmpdir %s/mondo.tmp.*", bkpinfo->tmpdir); 755 mr_asprintf( &tmp,"rm -Rf %s/mondo.tmp.*",bkpinfo->tmpdir);755 mr_asprintf(tmp,"rm -Rf %s/mondo.tmp.*",bkpinfo->tmpdir); 756 756 } 757 757 paranoid_system(tmp); … … 761 761 /* Always take in account arg first, then env, then default */ 762 762 if (path != NULL) { 763 mr_asprintf( &tmp, "%s/mondo.tmp.XXXXXX", path);763 mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", path); 764 764 } else if (getenv("TMPDIR")) { 765 mr_asprintf( &tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR"));765 mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR")); 766 766 } else if (getenv("MRTMP")) { 767 mr_asprintf( &tmp, "%s/mondo.tmp.XXXXXX", getenv("MRTMP"));767 mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", getenv("MRTMP")); 768 768 } else { 769 mr_asprintf( &tmp, "/tmp/mondo.tmp.XXXXXX");769 mr_asprintf(tmp, "/tmp/mondo.tmp.XXXXXX"); 770 770 } 771 771 p = mkdtemp(tmp); … … 777 777 paranoid_free(tmp); 778 778 779 mr_asprintf( &tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);779 mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); 780 780 paranoid_system(tmp); 781 781 mr_free(tmp); … … 794 794 if (strstr(bkpinfo->scratchdir,"mondo.scratch.") != NULL) { 795 795 log_it("Purging old scratchdir %s", bkpinfo->scratchdir); 796 mr_asprintf( &tmp,"rm -Rf %s",bkpinfo->scratchdir);796 mr_asprintf(tmp,"rm -Rf %s",bkpinfo->scratchdir); 797 797 } else { 798 798 log_it("Purging old scratchdir %s/mondo.scratch.*", bkpinfo->scratchdir); 799 mr_asprintf( &tmp,"rm -Rf %s/mondo.scratch.*",bkpinfo->scratchdir);799 mr_asprintf(tmp,"rm -Rf %s/mondo.scratch.*",bkpinfo->scratchdir); 800 800 } 801 801 paranoid_system(tmp); … … 805 805 /* Always take in account arg first, then env, then default */ 806 806 if (path != NULL) { 807 mr_asprintf( &tmp, "%s/mondo.scratch.XXXXXX", path);807 mr_asprintf(tmp, "%s/mondo.scratch.XXXXXX", path); 808 808 } else if (getenv("MRSCRATCH")) { 809 mr_asprintf( &tmp, "%s/mondo.scratch.XXXXXX", getenv("MRSCRATCH"));809 mr_asprintf(tmp, "%s/mondo.scratch.XXXXXX", getenv("MRSCRATCH")); 810 810 } else { 811 mr_asprintf( &tmp, "/tmp/mondo.scratch.XXXXXX");811 mr_asprintf(tmp, "/tmp/mondo.scratch.XXXXXX"); 812 812 } 813 813 p = mkdtemp(tmp); … … 819 819 paranoid_free(tmp); 820 820 821 mr_asprintf( &tmp, "mkdir -p %s", bkpinfo->scratchdir);821 mr_asprintf(tmp, "mkdir -p %s", bkpinfo->scratchdir); 822 822 paranoid_system(tmp); 823 823 mr_free(tmp); … … 909 909 assert_string_is_neither_NULL_nor_zerolength(partition); 910 910 911 mr_asprintf( &command, "df -m -P %s 1> /dev/null 2> /dev/null", partition);911 mr_asprintf(command, "df -m -P %s 1> /dev/null 2> /dev/null", partition); 912 912 if (system(command)) { 913 913 mr_free(command); … … 916 916 mr_free(command); 917 917 918 mr_asprintf( &command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4",918 mr_asprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4", 919 919 partition); 920 mr_asprintf( &out_sz, "%s", call_program_and_get_last_line_of_output(command));920 mr_asprintf(out_sz, "%s", call_program_and_get_last_line_of_output(command)); 921 921 mr_free(command); 922 922 … … 962 962 ("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE); 963 963 } 964 mr_asprintf( &tmp, "%s",964 mr_asprintf(tmp, "%s", 965 965 call_program_and_get_last_line_of_output 966 966 ("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2")); … … 1028 1028 run_program_and_log_output 1029 1029 ("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5); 1030 mr_asprintf( &tmp, "%s",1030 mr_asprintf(tmp, "%s", 1031 1031 call_program_and_get_last_line_of_output 1032 1032 ("mount | grep -E \"cdr(om|w)\"")); … … 1063 1063 fatal_error("Please reinstall Mondo and Mindi."); 1064 1064 } 1065 mr_asprintf( &tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir);1065 mr_asprintf(tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir); 1066 1066 if (run_program_and_log_output(tmp, 5)) { 1067 1067 mr_free(tmp); 1068 mr_asprintf( &tmp, "mindi --makemountlist %s/mountlist.txt.test failed for some reason.", bkpinfo->tmpdir);1068 mr_asprintf(tmp, "mindi --makemountlist %s/mountlist.txt.test failed for some reason.", bkpinfo->tmpdir); 1069 1069 log_to_screen(tmp); 1070 1070 log_to_screen … … 1111 1111 assert_string_is_neither_NULL_nor_zerolength(label); 1112 1112 if (!does_file_exist(config_file)) { 1113 mr_asprintf( &tmp, "(read_cfg_var) Cannot find %s config file",1113 mr_asprintf(tmp, "(read_cfg_var) Cannot find %s config file", 1114 1114 config_file); 1115 1115 log_to_screen(tmp); … … 1122 1122 return (0); 1123 1123 } else { 1124 mr_asprintf( &command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5",1124 mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", 1125 1125 label, config_file); 1126 1126 strcpy(value, call_program_and_get_last_line_of_output(command)); … … 1206 1206 log_msg(3, "%s --- autofs detected", g_autofs_exe); 1207 1207 // FIXME -- only disable it if it's running --- sprintf(tmp, "%s status", autofs_exe); 1208 mr_asprintf( &tmp, "%s stop", g_autofs_exe);1208 mr_asprintf(tmp, "%s stop", g_autofs_exe); 1209 1209 if (run_program_and_log_output(tmp, 2)) { 1210 1210 log_it("Failed to stop autofs - I assume it wasn't running"); … … 1228 1228 return; 1229 1229 } 1230 mr_asprintf( &tmp, "%s start", g_autofs_exe);1230 mr_asprintf(tmp, "%s start", g_autofs_exe); 1231 1231 if (run_program_and_log_output(tmp, 2)) { 1232 1232 log_it("Failed to start autofs"); … … 1251 1251 g_boot_mountpt[0] = '\0'; 1252 1252 log_msg(4, "Done. Great. Seeting command to something"); 1253 mr_asprintf( &command, "%s",1253 mr_asprintf(command, "%s", 1254 1254 "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[ ]/boot[ ]\" | tr -s ' ' '\t' | cut -f1 | head -n1"); 1255 1255 log_msg(4, "Cool. Command = '%s'", command); 1256 mr_asprintf( &tmp, "%s", call_program_and_get_last_line_of_output(command));1256 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1257 1257 mr_free(command); 1258 1258 … … 1260 1260 if (tmp[0]) { 1261 1261 log_it("/boot is at %s according to /etc/fstab", tmp); 1262 mr_asprintf( &command, "mount | grep -Ew '/boot'");1262 mr_asprintf(command, "mount | grep -Ew '/boot'"); 1263 1263 mr_free(tmp); 1264 mr_asprintf( &tmp, call_program_and_get_last_line_of_output(command));1264 mr_asprintf(tmp, call_program_and_get_last_line_of_output(command)); 1265 1265 mr_free(command); 1266 1266 … … 1274 1274 } 1275 1275 } else { 1276 mr_asprintf( &command, "mount | grep -E '^%s'", tmp);1276 mr_asprintf(command, "mount | grep -E '^%s'", tmp); 1277 1277 log_msg(3, "command = %s", command); 1278 1278 if (run_program_and_log_output(command, 5)) { 1279 1279 strcpy(g_boot_mountpt, tmp); 1280 1280 mr_free(tmp); 1281 mr_asprintf( &tmp,1281 mr_asprintf(tmp, 1282 1282 "%s (your /boot partition) is not mounted. I'll mount it before backing up", 1283 1283 g_boot_mountpt); … … 1285 1285 mr_free(tmp); 1286 1286 1287 mr_asprintf( &tmp, "mount %s", g_boot_mountpt);1287 mr_asprintf(tmp, "mount %s", g_boot_mountpt); 1288 1288 if (run_program_and_log_output(tmp, 5)) { 1289 1289 g_boot_mountpt[0] = '\0'; … … 1316 1316 log_msg(3, "starting"); 1317 1317 if (g_boot_mountpt[0]) { 1318 mr_asprintf( &tmp, "umount %s", g_boot_mountpt);1318 mr_asprintf(tmp, "umount %s", g_boot_mountpt); 1319 1319 if (run_program_and_log_output(tmp, 5)) { 1320 1320 log_it("WARNING - unable to unmount /boot"); … … 1348 1348 assert(value != NULL); 1349 1349 if (!does_file_exist(config_file)) { 1350 mr_asprintf( &tmp, "(write_cfg_file) Cannot find %s config file",1350 mr_asprintf(tmp, "(write_cfg_file) Cannot find %s config file", 1351 1351 config_file); 1352 1352 log_to_screen(tmp); … … 1354 1354 return (1); 1355 1355 } 1356 mr_asprintf( &tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir);1356 mr_asprintf(tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir); 1357 1357 if (does_file_exist(config_file)) { 1358 mr_asprintf( &command, "grep -vE '^%s .*$' %s > %s",1358 mr_asprintf(command, "grep -vE '^%s .*$' %s > %s", 1359 1359 label, config_file, tempfile); 1360 1360 paranoid_system(command); 1361 1361 mr_free(command); 1362 1362 } 1363 mr_asprintf( &command, "echo \"%s %s\" >> %s", label, value, tempfile);1363 mr_asprintf(command, "echo \"%s %s\" >> %s", label, value, tempfile); 1364 1364 paranoid_system(command); 1365 1365 mr_free(command); 1366 1366 1367 mr_asprintf( &command, "mv -f %s %s", tempfile, config_file);1367 mr_asprintf(command, "mv -f %s %s", tempfile, config_file); 1368 1368 paranoid_system(command); 1369 1369 mr_free(command); … … 1536 1536 1537 1537 if (g_magicdev_command && g_magicdev_command[0]) { 1538 mr_asprintf( &tmp, "%s &", g_magicdev_command);1538 mr_asprintf(tmp, "%s &", g_magicdev_command); 1539 1539 paranoid_system(tmp); 1540 1540 mr_free(tmp); -
branches/3.0/mondo/src/common/libmondo-verify.c
r3180 r3185 333 333 bkpinfo->restore_path, 334 334 biggiestruct.filename); 335 mr_asprintf( &mds, "echo \"%s/%s not found\" >> %s/biggies.changed",335 mr_asprintf(mds, "echo \"%s/%s not found\" >> %s/biggies.changed", 336 336 bkpinfo->restore_path, 337 337 biggiestruct.filename, … … 981 981 assert(bkpinfo != NULL); 982 982 983 mr_asprintf( &fname, "%s1", bkpinfo->media_device);983 mr_asprintf(fname, "%s1", bkpinfo->media_device); 984 984 if (is_this_device_mounted(fname)) { 985 985 log_msg(1, "USB device mounted. Remounting it at the right place"); 986 mr_asprintf( &tmp, "umount %s", fname);986 mr_asprintf(tmp, "umount %s", fname); 987 987 run_program_and_log_output(tmp, FALSE); 988 988 paranoid_free(tmp); … … 991 991 992 992 log_msg(1, "Mounting USB device."); 993 mr_asprintf( &mountpoint, "%s/usb", bkpinfo->tmpdir);994 mr_asprintf( &tmp, "mkdir -p %s", mountpoint);993 mr_asprintf(mountpoint, "%s/usb", bkpinfo->tmpdir); 994 mr_asprintf(tmp, "mkdir -p %s", mountpoint); 995 995 run_program_and_log_output(tmp, FALSE); 996 996 paranoid_free(tmp); 997 997 /* Mindi always create one single parition on the USB dev */ 998 mr_asprintf( &tmp, "mount %s1 %s", bkpinfo->media_device, mountpoint);998 mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, mountpoint); 999 999 ret = run_program_and_log_output(tmp, FALSE); 1000 1000 paranoid_free(tmp); … … 1006 1006 sync(); 1007 1007 log_msg(2, "OK, I've mounted the USB Disk/Key\n"); 1008 mr_asprintf( &tmp, "%s/archives/NOT-THE-LAST", mountpoint);1008 mr_asprintf(tmp, "%s/archives/NOT-THE-LAST", mountpoint); 1009 1009 if (!does_file_exist(tmp)) { 1010 1010 log_msg … … 1023 1023 verify_all_slices_on_CD(mountpoint); 1024 1024 1025 mr_asprintf( &tmp1, "umount -d %s", mountpoint);1025 mr_asprintf(tmp1, "umount -d %s", mountpoint); 1026 1026 #ifdef __FreeBSD__ 1027 1027 ret += system(tmp1); … … 1032 1032 #endif 1033 1033 { 1034 mr_asprintf( &tmp, "%s failed; unable to unmount USB device\n", tmp1);1034 mr_asprintf(tmp, "%s failed; unable to unmount USB device\n", tmp1); 1035 1035 log_to_screen(tmp); 1036 1036 paranoid_free(tmp); -
branches/3.0/mondo/src/common/newt-specific.c
r3154 r3185 296 296 char *tmp1 = NULL; 297 297 298 mr_asprintf( &tmp,"ps %s | grep \" %s \" | grep -v \"grep\" | awk '{print %s;}'", ps_options, str , ps_proc_id);298 mr_asprintf(tmp,"ps %s | grep \" %s \" | grep -v \"grep\" | awk '{print %s;}'", ps_options, str , ps_proc_id); 299 299 run_program_and_log_output(tmp, TRUE); 300 300 if (strlen(tmp) > 0) { 301 mr_asprintf( &tmp1,"kill `%s`", tmp);301 mr_asprintf(tmp1,"kill `%s`", tmp); 302 302 run_program_and_log_output(tmp1, TRUE); 303 303 paranoid_free(tmp1); … … 434 434 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); 435 435 if (g_selfmounted_isodir) { 436 mr_asprintf( &command, "umount -d %s", g_selfmounted_isodir);436 mr_asprintf(command, "umount -d %s", g_selfmounted_isodir); 437 437 run_program_and_log_output(command, 1); 438 438 paranoid_free(command); 439 mr_asprintf( &command, "rmdir %s", g_selfmounted_isodir);439 mr_asprintf(command, "rmdir %s", g_selfmounted_isodir); 440 440 run_program_and_log_output(command, 1); 441 441 paranoid_free(command); … … 456 456 if (strstr(bkpinfo->tmpdir ,"mondo.tmp.") != NULL) { 457 457 log_msg(8,"erasing tempdir %s",bkpinfo->tmpdir); 458 mr_asprintf( &command, "rm -Rf %s", bkpinfo->tmpdir);458 mr_asprintf(command, "rm -Rf %s", bkpinfo->tmpdir); 459 459 paranoid_system(command); 460 460 mr_free(command); … … 465 465 if (strstr(bkpinfo->scratchdir ,"mondo.scratch.") != NULL) { 466 466 log_msg(8,"erasing scratchdir %s",bkpinfo->scratchdir); 467 mr_asprintf( &command, "rm -Rf %s", bkpinfo->scratchdir);467 mr_asprintf(command, "rm -Rf %s", bkpinfo->scratchdir); 468 468 paranoid_system(command); 469 469 mr_free(command); … … 515 515 } 516 516 if (grep_for_me[0] != '\0') { 517 mr_asprintf( &command, "grep '%s' %s | tail -n%d",517 mr_asprintf(command, "grep '%s' %s | tail -n%d", 518 518 grep_for_me, filename, g_noof_log_lines); 519 519 } else { 520 mr_asprintf( &command, "tail -n%d %s", g_noof_log_lines,520 mr_asprintf(command, "tail -n%d %s", g_noof_log_lines, 521 521 filename); 522 522 } … … 536 536 */ 537 537 if (!strncmp(err_log_lines[i], "root:", 5)) { 538 mr_asprintf( &tmp, "%s", err_log_lines[i] + 6);538 mr_asprintf(tmp, "%s", err_log_lines[i] + 6); 539 539 strncpy(err_log_lines[i], tmp, (size_t)MAX_NEWT_COMMENT_LEN); 540 540 mr_free(tmp); … … 1074 1074 (long) time_remaining % 60); 1075 1075 if (percentage < 3) { 1076 mr_asprintf( &pcline_str, " Working");1076 mr_asprintf(pcline_str, " Working"); 1077 1077 for (j = 0; j < g_mysterious_dot_counter; j++) { 1078 1078 mr_strcat(pcline_str, "."); … … 1083 1083 mr_strcat(pcline_str, " %c", special_dot_char(g_mysterious_dot_counter)); 1084 1084 } else { 1085 mr_asprintf( &pcline_str, " %3d%% done %3d%% to go",1085 mr_asprintf(pcline_str, " %3d%% done %3d%% to go", 1086 1086 percentage, 100 - percentage); 1087 1087 } 1088 1088 if (g_text_mode) { 1089 mr_asprintf( &taskprogress, "TASK: [");1089 mr_asprintf(taskprogress, "TASK: ["); 1090 1090 for (i = 0; i < percentage; i += 5) { 1091 1091 mr_strcat(taskprogress, "*"); … … 1234 1234 printf("---progress-form---3--- %s\n", blurb3); 1235 1235 printf("---progress-form---E---\n"); 1236 mr_asprintf( &taskprogress, "TASK: [");1236 mr_asprintf(taskprogress, "TASK: ["); 1237 1237 for (i = 0; i < percentage; i += 5) { 1238 1238 mr_strcat(taskprogress, "*"); … … 1443 1443 newtPopWindow(); 1444 1444 if (b_res == b1) { 1445 mr_asprintf( &output, "%s", "bzip2");1445 mr_asprintf(output, "%s", "bzip2"); 1446 1446 } else if (b_res == b2) { 1447 mr_asprintf( &output, "%s", "gzip");1447 mr_asprintf(output, "%s", "gzip"); 1448 1448 } else if (b_res == b3) { 1449 mr_asprintf( &output, "%s", "lzo");1449 mr_asprintf(output, "%s", "lzo"); 1450 1450 //} else if (b_res == b4) { 1451 //mr_asprintf( &output, "%s", "lzma");1451 //mr_asprintf(output, "%s", "lzma"); 1452 1452 } 1453 1453 newtPopHelpLine(); … … 1540 1540 } 1541 1541 1542 mr_asprintf( &tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir);1542 mr_asprintf(tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir); 1543 1543 if (!(fout = fopen(tmp1, "a"))) { 1544 1544 log_msg(2, "Can't write to %s", tmp1); … … 1637 1637 assert(flentry != NULL); 1638 1638 if (flentry->severity == 0) { 1639 mr_asprintf( &tmp, "0 ");1639 mr_asprintf(tmp, "0 "); 1640 1640 } else if (flentry->severity == 1) { 1641 mr_asprintf( &tmp, "low ");1641 mr_asprintf(tmp, "low "); 1642 1642 } else if (flentry->severity == 2) { 1643 mr_asprintf( &tmp, "med ");1644 } else { 1645 mr_asprintf( &tmp, "high");1643 mr_asprintf(tmp, "med "); 1644 } else { 1645 mr_asprintf(tmp, "high"); 1646 1646 } 1647 1647 mr_strcat(tmp, " "); -
branches/3.0/mondo/src/include/mr_mem.h
r3128 r3185 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)22 #define mr_getline(x,y) mr_getline_int( x,y,__LINE__,__FILE__)21 #define mr_asprintf(x,y,args...) mr_asprintf_int((char **)&x,__LINE__,__FILE__,y,## args) 22 #define mr_getline(x,y) mr_getline_int((char **)&x,y,__LINE__,__FILE__) 23 23 #define mr_malloc(x) mr_malloc_int((size_t)x,__LINE__,__FILE__) 24 24 #define mr_setenv(x,y) mr_setenv_int(x,y,__LINE__,__FILE__) -
branches/3.0/mondo/src/lib/mr_conf.c
r3060 r3185 107 107 CONF = fopen(filename, "r"); 108 108 109 mr_asprintf( &mr_conf_filename, "%s", filename);109 mr_asprintf(mr_conf_filename, "%s", filename); 110 110 111 111 /*if file is empty or not exist => error */ … … 199 199 p = mr_conf_read(field_name); 200 200 if (p != NULL) { 201 mr_asprintf( &p1, "%d", p);201 mr_asprintf(p1, "%d", p); 202 202 } 203 203 return p1; … … 211 211 p = mr_conf_read(field_name); 212 212 if (p != NULL) { 213 mr_asprintf( &p1, "%f", p);213 mr_asprintf(p1, "%f", p); 214 214 } 215 215 return p1; … … 233 233 return(p); 234 234 } 235 mr_asprintf( &q, "%s", p);235 mr_asprintf(q, "%s", p); 236 236 237 237 if (*p != '"') { … … 276 276 (strncasecmp(p, "t" , (size_t)1) == 0) || 277 277 (strncasecmp(p, "1" , (size_t)1) == 0)) { 278 mr_asprintf( &p1, "%d", TRUE);278 mr_asprintf(p1, "%d", TRUE); 279 279 } else { 280 mr_asprintf( &p1, "%d", FALSE);280 mr_asprintf(p1, "%d", FALSE); 281 281 } 282 282 } … … 289 289 char *p = NULL; 290 290 291 mr_asprintf( &p, "%d", FALSE);291 mr_asprintf(p, "%d", FALSE); 292 292 if (strcmp(str,p) != 0) { 293 293 ret = TRUE; -
branches/3.0/mondo/src/lib/mr_mem.c
r3127 r3185 122 122 */ 123 123 void mr_strcat_int(char **in, int line, const char *file, const char *fmt, ...) { 124 125 124 char *fmt2 = NULL; 126 125 va_list args; -
branches/3.0/mondo/src/mondoarchive/mondoarchive.c
r3141 r3185 206 206 207 207 /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */ 208 mr_asprintf( &tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH"));208 mr_asprintf(tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH")); 209 209 setenv("PATH", tmp1, 1); 210 210 paranoid_free(tmp1); 211 211 212 212 /* Add the ARCH environment variable for ia64 purposes */ 213 mr_asprintf( &tmp1,"%s",get_architecture());213 mr_asprintf(tmp1,"%s",get_architecture()); 214 214 setenv("ARCH", tmp1, 1); 215 215 paranoid_free(tmp1); … … 382 382 retval += res; 383 383 if (res) { 384 mr_asprintf( &say_at_end, "Data archived. Please check the logs, just as a precaution. ");385 } else { 386 mr_asprintf( &say_at_end, "Data archived OK. ");384 mr_asprintf(say_at_end, "Data archived. Please check the logs, just as a precaution. "); 385 } else { 386 mr_asprintf(say_at_end, "Data archived OK. "); 387 387 } 388 388 } … … 392 392 res = verify_data(); 393 393 if (res < 0) { 394 mr_asprintf( &tmp, "%d difference%c found.", -res,394 mr_asprintf(tmp, "%d difference%c found.", -res, 395 395 (-res != 1) ? 's' : ' '); 396 mr_asprintf( &say_at_end, "%s", tmp);396 mr_asprintf(say_at_end, "%s", tmp); 397 397 log_to_screen(tmp); 398 398 mr_free(tmp); … … 432 432 paranoid_free(say_at_end); 433 433 } 434 mr_asprintf( &tmp, "umount %s/tmpfs", bkpinfo->tmpdir);434 mr_asprintf(tmp, "umount %s/tmpfs", bkpinfo->tmpdir); 435 435 run_program_and_log_output(tmp, TRUE); 436 436 mr_free(tmp); 437 437 if (bkpinfo->backup_media_type == usb) { 438 438 log_msg(1, "Unmounting USB device."); 439 mr_asprintf( &tmp, "umount %s1", bkpinfo->media_device);439 mr_asprintf(tmp, "umount %s1", bkpinfo->media_device); 440 440 run_program_and_log_output(tmp, TRUE); 441 441 mr_free(tmp); -
branches/3.0/mondo/src/mondorestore/mondo-prep.c
r3071 r3185 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 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 free(tmp1); … … 586 586 // create device list from normal disks followed by spare ones 587 587 if (raidlist->el[i].data_disks.el[0].device != NULL) { 588 mr_asprintf( &devices, "%s", raidlist->el[i].data_disks.el[0].device);588 mr_asprintf(devices, "%s", raidlist->el[i].data_disks.el[0].device); 589 589 log_msg(4, "Adding device %s to list", raidlist->el[i].data_disks.el[0].device); 590 590 } else { … … 602 602 // translate RAID level 603 603 if (raidlist->el[i].raid_level == -2) { 604 mr_asprintf( &level, "multipath");604 mr_asprintf(level, "multipath"); 605 605 } else if (raidlist->el[i].raid_level == -1) { 606 mr_asprintf( &level, "linear");606 mr_asprintf(level, "linear"); 607 607 } else { 608 mr_asprintf( &level, "raid%d", raidlist->el[i].raid_level);608 mr_asprintf(level, "raid%d", raidlist->el[i].raid_level); 609 609 } 610 610 // create RAID device: … … 614 614 // - persistent superblock always used as this is recommended 615 615 616 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);616 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); 617 617 mr_free(level); 618 618 log_msg(4, "cmd built: %s", program); … … 718 718 719 719 if (strstr(format, "raid")) { // do not form RAID disks; do it to /dev/md* instead 720 mr_asprintf( &tmp, "Not formatting %s (it is a RAID disk)", device);720 mr_asprintf(tmp, "Not formatting %s (it is a RAID disk)", device); 721 721 log_it(tmp); 722 722 paranoid_free(tmp); … … 733 733 #endif 734 734 if (strlen(format) <= 2) { 735 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);735 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); 736 736 log_it(tmp); 737 737 paranoid_free(tmp); … … 740 740 } 741 741 if (is_this_device_mounted(device)) { 742 mr_asprintf( &tmp, "%s is mounted - cannot format it ", device);742 mr_asprintf(tmp, "%s is mounted - cannot format it ", device); 743 743 log_to_screen(tmp); 744 744 paranoid_free(tmp); … … 771 771 char line[MAX_STR_LEN]; 772 772 773 mr_asprintf( &tmp, "Initializing Vinum device %s (this may take a *long* time)", device);773 mr_asprintf(tmp, "Initializing Vinum device %s (this may take a *long* time)", device); 774 774 log_to_screen(tmp); 775 775 paranoid_free(tmp); … … 789 789 *(strchr(line, '\n')) = '\0'; // get rid of the \n on the end 790 790 791 mr_asprintf( &tmp, "Initializing plex: %s", line);791 mr_asprintf(tmp, "Initializing plex: %s", line); 792 792 open_evalcall_form(tmp); 793 793 paranoid_free(tmp); 794 794 795 mr_asprintf( &tmp, "vinum init %s", line);795 mr_asprintf(tmp, "vinum init %s", line); 796 796 paranoid_system(tmp); 797 797 paranoid_free(tmp); 798 798 799 799 while (1) { 800 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);800 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); 801 801 FILE *pin = popen(tmp, "r"); 802 802 paranoid_free(tmp); … … 820 820 } 821 821 #else 822 mr_asprintf( &tmp, "Initializing RAID device %s", device);822 mr_asprintf(tmp, "Initializing RAID device %s", device); 823 823 log_to_screen(tmp); 824 824 paranoid_free(tmp); … … 871 871 } 872 872 res = which_format_command_do_i_need(format, program); 873 mr_asprintf( &tmp, "%s %s", program, device);873 mr_asprintf(tmp, "%s %s", program, device); 874 874 if (strstr(program, "kludge")) { 875 875 mr_strcat(tmp, " /"); … … 878 878 paranoid_free(tmp); 879 879 880 mr_asprintf( &tmp, "Formatting %s as %s", device, format);880 mr_asprintf(tmp, "Formatting %s as %s", device, format); 881 881 update_progress_form(tmp); 882 882 paranoid_free(tmp); … … 892 892 893 893 if (res && strstr(program, "kludge")) { 894 mr_asprintf( &tmp, "Kludge failed; using regular mkfs.%s to format %s",894 mr_asprintf(tmp, "Kludge failed; using regular mkfs.%s to format %s", 895 895 format, device); 896 896 #ifdef __FreeBSD__ … … 1705 1705 paranoid_system(tmp); 1706 1706 // mark relevant partition as bootable 1707 mr_asprintf( &tmp1,"make-me-bootable /tmp/mountlist.txt %s",drivename);1707 mr_asprintf(tmp1,"make-me-bootable /tmp/mountlist.txt %s",drivename); 1708 1708 call_program_and_get_last_line_of_output(tmp1); 1709 1709 mr_free(tmp1); … … 1817 1817 /* BERLIOS: should not be called each time */ 1818 1818 part_table_fmt = which_partition_format(drive); 1819 mr_asprintf( &output, "");1819 mr_asprintf(output, ""); 1820 1820 /* make it a primary/extended/logical */ 1821 1821 if (partno <= 4) { … … 2169 2169 fput_string_one_char_at_a_time(pout_to_fdisk, "p\n"); 2170 2170 } else { 2171 mr_asprintf( &output, "t\n%d\n%s\nw\n", partno, partcode);2171 mr_asprintf(output, "t\n%d\n%s\nw\n", partno, partcode); 2172 2172 sprintf(command, "parted2fdisk %s >> %s 2>> %s", drive, 2173 2173 MONDO_LOGFILE, MONDO_LOGFILE); … … 2519 2519 return; 2520 2520 } 2521 mr_asprintf( &tmp, "Expanding entries to suit drive %s (%lld MB)", drive_name, current_size_of_drive / 1024);2521 mr_asprintf(tmp, "Expanding entries to suit drive %s (%lld MB)", drive_name, current_size_of_drive / 1024); 2522 2522 log_to_screen(tmp); 2523 2523 mr_free(tmp); … … 2539 2539 2540 2540 if (original_size_of_drive <= 0LL) { 2541 mr_asprintf( &tmp, "Cannot resize %s's entries. Drive not found.", drive_name);2541 mr_asprintf(tmp, "Cannot resize %s's entries. Drive not found.", drive_name); 2542 2542 log_to_screen(tmp); 2543 2543 mr_free(tmp); … … 2545 2545 } 2546 2546 factor = ((float)current_size_of_drive/(float)original_size_of_drive); 2547 mr_asprintf( &tmp, "Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %.5f)",2547 mr_asprintf(tmp, "Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %.5f)", 2548 2548 drive_name, original_size_of_drive/1024, current_size_of_drive/1024, factor); 2549 2549 log_to_screen(tmp); … … 2572 2572 totalsizL += newsizL; 2573 2573 2574 mr_asprintf( &tmp, "Changing %s from %lld KB to %lld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);2574 mr_asprintf(tmp, "Changing %s from %lld KB to %lld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL); 2575 2575 log_to_screen(tmp); 2576 2576 mr_free(tmp); … … 2579 2579 // Ensures over-allocation alert and prompt for interactive mode does not happen 2580 2580 if (totalsizL > current_size_of_drive) { 2581 mr_asprintf( &tmp, "Last partition size calculated would be over-allocated, reducing %s from %lld KB to %lld KB.", drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size - (totalsizL - current_size_of_drive));2581 mr_asprintf(tmp, "Last partition size calculated would be over-allocated, reducing %s from %lld KB to %lld KB.", drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size - (totalsizL - current_size_of_drive)); 2582 2582 drivemntlist->el[drivemntlist->entries-1]->size -= (totalsizL - current_size_of_drive); 2583 2583 } else if (totalsizL < current_size_of_drive) { 2584 mr_asprintf( &tmp, "Last partition size calculated would be under-allocated, increasing %s from %lld KB to %lld KB.",drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size + (current_size_of_drive - totalsizL));2584 mr_asprintf(tmp, "Last partition size calculated would be under-allocated, increasing %s from %lld KB to %lld KB.",drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size + (current_size_of_drive - totalsizL)); 2585 2585 drivemntlist->el[drivemntlist->entries-1]->size += (current_size_of_drive - totalsizL); 2586 2586 } 2587 2587 log_to_screen(tmp); 2588 2588 mr_free(tmp); 2589 mr_asprintf( &tmp, "final_size = %lld MB", current_size_of_drive / 1024);2589 mr_asprintf(tmp, "final_size = %lld MB", current_size_of_drive / 1024); 2590 2590 log_to_screen(tmp); 2591 2591 mr_free(tmp); -
branches/3.0/mondo/src/mondorestore/mondo-rstr-compare.c
r3060 r3185 81 81 insist_on_this_cd_number((++g_current_media_number)); 82 82 } else { 83 mr_asprintf( &tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob.");83 mr_asprintf(tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob."); 84 84 log_msg(2, tmp_ptr); 85 85 paranoid_free(tmp_ptr); … … 88 88 } 89 89 if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) { 90 mr_asprintf( &tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr);90 mr_asprintf(tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr); 91 91 log_to_screen(tmp_ptr); 92 92 paranoid_free(tmp_ptr); … … 105 105 106 106 if (!g_text_mode) { 107 mr_asprintf( &tmp_ptr, "Comparing %s", bigfile_fname_ptr);107 mr_asprintf(tmp_ptr, "Comparing %s", bigfile_fname_ptr); 108 108 newtDrawRootText(0, 22, tmp_ptr); 109 109 paranoid_free(tmp_ptr); … … 121 121 } 122 122 log_msg(2, command_ptr); 123 mr_asprintf( &tmp_ptr, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);123 mr_asprintf(tmp_ptr, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE); 124 124 paranoid_system(tmp_ptr); 125 125 paranoid_free(tmp_ptr); … … 149 149 } 150 150 } 151 mr_asprintf( &tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr);151 mr_asprintf(tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr); 152 152 if (!strcmp(checksum_ptr, original_cksum_ptr) != 0) { 153 153 mr_strcat(tmp_ptr, " ... OK"); … … 280 280 281 281 if (use_star) { 282 mr_asprintf( &archiver_exe, "star");283 } else { 284 mr_asprintf( &archiver_exe, "afio");282 mr_asprintf(archiver_exe, "star"); 283 } else { 284 mr_asprintf(archiver_exe, "afio"); 285 285 } 286 286 -
branches/3.0/mondo/src/mondorestore/mondo-rstr-newt.c
r3158 r3185 1974 1974 /* flaws_str can be NULL */ 1975 1975 if ((flaws_str == NULL) || (strlen(flaws_str) == 0)) { 1976 mr_asprintf( &flaws_str_A, "");1976 mr_asprintf(flaws_str_A, ""); 1977 1977 } else { 1978 mr_asprintf( &flaws_str_A, "%s", flaws_str + 1);1978 mr_asprintf(flaws_str_A, "%s", flaws_str + 1); 1979 1979 } 1980 1980 if (strlen(flaws_str_A) >= 74) { 1981 1981 for (i = 74; flaws_str_A[i] != ' '; i--); 1982 mr_asprintf( &flaws_str_B, "%s", flaws_str_A + i + 1);1982 mr_asprintf(flaws_str_B, "%s", flaws_str_A + i + 1); 1983 1983 flaws_str_A[i] = '\0'; 1984 1984 } else { 1985 mr_asprintf( &flaws_str_B, "");1985 mr_asprintf(flaws_str_B, ""); 1986 1986 } 1987 1987 if (strlen(flaws_str_B) >= 74) { 1988 1988 for (i = 74; flaws_str_B[i] != ' '; i--); 1989 mr_asprintf( &flaws_str_C, "%s", flaws_str_B + i + 1);1989 mr_asprintf(flaws_str_C, "%s", flaws_str_B + i + 1); 1990 1990 flaws_str_B[i] = '\0'; 1991 1991 } else { 1992 mr_asprintf( &flaws_str_C, "");1992 mr_asprintf(flaws_str_C, ""); 1993 1993 } 1994 1994 -
branches/3.0/mondo/src/mondorestore/mondo-rstr-tools.c
r3158 r3185 330 330 if (HDD) { 331 331 /* We need an additional param */ 332 mr_asprintf( &(bkpinfo->subdir), "%s", bkpinfo->isodir);332 mr_asprintf(bkpinfo->subdir, "%s", bkpinfo->isodir); 333 333 strcpy(bkpinfo->isodir, "/tmp/isodir"); 334 334 log_it("Now bkpinfo->isodir = %s and subdir = ", bkpinfo->isodir, bkpinfo->subdir); … … 383 383 log_to_screen("WARNING - isodir is already mounted"); 384 384 } else { 385 mr_asprintf( &mount_isodir_command, "mount %s", g_isodir_device);385 mr_asprintf(mount_isodir_command, "mount %s", g_isodir_device); 386 386 if (strlen(g_isodir_format) > 1) { 387 387 mr_strcat(mount_isodir_command, " -t %s", g_isodir_format); … … 478 478 log_msg(1, tmp); 479 479 /* Deal with additional params only if not /proc or /sys */ 480 mr_asprintf( &additional_parameters, "");480 mr_asprintf(additional_parameters, ""); 481 481 if (strcmp(format, "proc") && strcmp(format, "sys")) { 482 482 if (writeable) { … … 586 586 "", mountlist->entries); 587 587 588 mr_asprintf( &these_failed, "");588 mr_asprintf(these_failed, ""); 589 589 for (lino = 0; lino < mountlist->entries; lino++) { 590 590 if (!strcmp(mountlist->el[lino].device, "/proc")) { … … 766 766 bkpinfo->please_dont_eject = TRUE; 767 767 if (read_cfg_var(cfg_file, "netfs-proto", value) == 0) { 768 mr_asprintf( &(bkpinfo->netfs_proto),"%s", value);768 mr_asprintf(bkpinfo->netfs_proto,"%s", value); 769 769 } else { 770 770 /* For compatibility, force protocol in old nfs case to be transparent */ 771 mr_asprintf( &(bkpinfo->netfs_proto), "nfs");771 mr_asprintf(bkpinfo->netfs_proto, "nfs"); 772 772 } 773 773 if (read_cfg_var(cfg_file, "netfs-server-user", value) == 0) { 774 mr_asprintf( &(bkpinfo->netfs_user),"%s", value);774 mr_asprintf(bkpinfo->netfs_user,"%s", value); 775 775 } 776 776 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { … … 851 851 read_cfg_var(cfg_file, "acl", value); 852 852 if (strstr(value, "TRUE")) { 853 mr_asprintf( &g_getfacl,"setfacl");853 mr_asprintf(g_getfacl,"setfacl"); 854 854 log_msg(1, "We will restore ACLs"); 855 855 if (! find_home_of_exe("setfacl")) { … … 859 859 read_cfg_var(cfg_file, "xattr", value); 860 860 if (strstr(value, "TRUE")) { 861 mr_asprintf( &g_getfattr,"setfattr");861 mr_asprintf(g_getfattr,"setfattr"); 862 862 log_msg(1, "We will restore XATTRs"); 863 863 if (! find_home_of_exe("setfattr")) { … … 1370 1370 * the current /dev location 1371 1371 */ 1372 mr_asprintf( &cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);1372 mr_asprintf(cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING); 1373 1373 run_program_and_log_output(cmd, 3); 1374 1374 paranoid_free(cmd); … … 1385 1385 read_cfg_var(g_mondo_cfg_file, "bootloader.device", device); 1386 1386 read_cfg_var(g_mondo_cfg_file, "bootloader.name", name); 1387 mr_asprintf( &tmp, "run_boot_loader: device='%s', name='%s'", device, name);1387 mr_asprintf(tmp, "run_boot_loader: device='%s', name='%s'", device, name); 1388 1388 log_msg(2, tmp); 1389 1389 paranoid_free(tmp); … … 1402 1402 #ifdef __FreeBSD__ 1403 1403 else if (!strcmp(name, "BOOT0")) { 1404 mr_asprintf( &tmp, "boot0cfg -B %s", device);1404 mr_asprintf(tmp, "boot0cfg -B %s", device); 1405 1405 res = run_program_and_log_output(tmp, FALSE); 1406 1406 paranoid_free(tmp); 1407 1407 } else { 1408 mr_asprintf( &tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device);1408 mr_asprintf(tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device); 1409 1409 if (!system(tmp)) { 1410 1410 paranoid_free(tmp); 1411 mr_asprintf( &tmp, MNT_RESTORING "/sbin/fdisk -B %s", device);1411 mr_asprintf(tmp, MNT_RESTORING "/sbin/fdisk -B %s", device); 1412 1412 res = run_program_and_log_output(tmp, 3); 1413 1413 } else { … … 2056 2056 paranoid_system("sync"); 2057 2057 2058 mr_asprintf( &tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);2058 mr_asprintf(tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE); 2059 2059 if (run_program_and_log_output(tmp, FALSE)) { 2060 2060 log_msg(1, … … 2075 2075 continue; 2076 2076 } 2077 mr_asprintf( &tmp, "Unmounting device %s ", mountlist->el[lino].device);2077 mr_asprintf(tmp, "Unmounting device %s ", mountlist->el[lino].device); 2078 2078 2079 2079 update_progress_form(tmp); -
branches/3.0/mondo/src/mondorestore/mondorestore.c
r3158 r3185 354 354 355 355 /* Clean up blkid cache file if they exist */ 356 mr_asprintf( &tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path);356 mr_asprintf(tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path); 357 357 (void)unlink(tmp1); 358 358 paranoid_free(tmp1); 359 mr_asprintf( &tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);359 mr_asprintf(tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path); 360 360 (void)unlink(tmp1); 361 361 paranoid_free(tmp1); … … 369 369 370 370 /* Clean up multiconf cache file if they exist */ 371 mr_asprintf( &tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);371 mr_asprintf(tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path); 372 372 (void)unlink(tmp1); 373 373 paranoid_free(tmp1); 374 374 375 375 /* Edit multipath.conf if needed to adapt wwid */ 376 mr_asprintf( &tmp1,"%s/etc/multipath.conf", MNT_RESTORING);376 mr_asprintf(tmp1,"%s/etc/multipath.conf", MNT_RESTORING); 377 377 if (does_file_exist(tmp1)) { 378 378 log_msg(2, "We may need to clean /etc/multipath.conf"); … … 384 384 385 385 if (bkpinfo->restore_mode != nuke) { 386 mr_asprintf( &editor, "%s", find_my_editor());387 mr_asprintf( &tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);386 mr_asprintf(editor, "%s", find_my_editor()); 387 mr_asprintf(tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor); 388 388 popup_and_OK("You will now edit multipath.conf"); 389 389 if (!g_text_mode) { … … 1670 1670 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 1671 1671 // sprintf(files_to_restore_this_time_fname, "/tmp/ftrttf.%d.%d", (int)getpid(), (int)random()); 1672 mr_asprintf( &command, "mkdir -p %s/tmp", MNT_RESTORING);1672 mr_asprintf(command, "mkdir -p %s/tmp", MNT_RESTORING); 1673 1673 run_program_and_log_output(command, 9); 1674 1674 paranoid_free(command); … … 1757 1757 // if (strstr(tarball_fname, ".star.")) 1758 1758 if (use_star) { 1759 mr_asprintf( &command, "star -x -force-remove -sparse -U " STAR_ACL_SZ " file=%s", tarball_fname);1759 mr_asprintf(command, "star -x -force-remove -sparse -U " STAR_ACL_SZ " file=%s", tarball_fname); 1760 1760 if (strstr(tarball_fname, ".bz2")) { 1761 1761 mr_strcat(command, " -bz"); … … 1763 1763 } else { 1764 1764 if (filelist_subset_fname[0] != '\0') { 1765 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);1765 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); 1766 1766 } else { 1767 mr_asprintf( &command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);1767 mr_asprintf(command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname); 1768 1768 } 1769 1769 } … … 1818 1818 // Be verbose for star 1819 1819 if (retval || use_star) { 1820 mr_asprintf( &command, "cat %s >> %s", temp_log, MONDO_LOGFILE);1820 mr_asprintf(command, "cat %s >> %s", temp_log, MONDO_LOGFILE); 1821 1821 paranoid_system(command); 1822 1822 paranoid_free(command); … … 2310 2310 filelist); 2311 2311 } 2312 mr_asprintf( &tmp1, "%s #%d, fileset #%ld - restore ",2312 mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ", 2313 2313 mds, g_current_media_number, current_tarball_number); 2314 2314 if (res) { -
branches/3.0/mondo/test/test-mountlist.c
r3158 r3185 56 56 char *flaws_str = NULL; 57 57 58 mr_asprintf( &MONDO_LOGFILE,"/tmp/mrtest-mountlist.log");58 mr_asprintf(MONDO_LOGFILE,"/tmp/mrtest-mountlist.log"); 59 59 60 60 /* Globals */ … … 72 72 73 73 setup_newt_stuff(); 74 mr_asprintf( &g_mountlist_fname, MOUNTLIST_TEST);74 mr_asprintf(g_mountlist_fname, MOUNTLIST_TEST); 75 75 log_it("before mountlist"); 76 76 load_mountlist(mountlist, g_mountlist_fname); -
branches/3.0/mondo/test/test-truncname.c
r3158 r3185 67 67 int i; 68 68 69 mr_asprintf( &MONDO_LOGFILE,"/tmp/mrtest-truncname.log");69 mr_asprintf(MONDO_LOGFILE,"/tmp/mrtest-truncname.log"); 70 70 71 71 /* Globals */ … … 77 77 for (i=0; list[i] != NULL; i++) { 78 78 log_it("%d: partition %s ...",i, list[i]); 79 mr_asprintf( &part,"%s",list[i]);79 mr_asprintf(part,"%s",list[i]); 80 80 disk = truncate_to_drive_name(part); 81 81 log_it("...belongs to disk %s",disk);
Note:
See TracChangeset
for help on using the changeset viewer.