Changeset 2323 in MondoRescue for branches/2.2.10/mondo/src/mondorestore
- Timestamp:
- Aug 18, 2009, 3:05:43 PM (15 years ago)
- Location:
- branches/2.2.10/mondo/src/mondorestore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/mondorestore/mondo-prep.c
r2316 r2323 79 79 make_list_of_drives_in_mountlist(mountlist, drivelist); 80 80 for (lino = 0; lino < drivelist->entries; lino++) { 81 mr_asprintf( &command, "dd if=%s bs=512 count=1 2> /dev/null | grep \"%s\"", drivelist->el[lino].device, MONDO_WAS_HERE);81 mr_asprintf(command, "dd if=%s bs=512 count=1 2> /dev/null | grep \"%s\"", drivelist->el[lino].device, MONDO_WAS_HERE); 82 82 res = run_program_and_log_output(command, 1); 83 83 mr_free(command); … … 258 258 strcpy(vgremove_sz, "vgremove"); 259 259 } 260 mr_asprintf( &tmp1, "for i in `%s | cut -d\"'\" -f2 | sort -r` ; do echo \"Shutting down lv $i\" >> %s ; %s -f $i; done", lvscan_sz, MONDO_LOGFILE, lvremove_sz);260 mr_asprintf(tmp1, "for i in `%s | cut -d\"'\" -f2 | sort -r` ; do echo \"Shutting down lv $i\" >> %s ; %s -f $i; done", lvscan_sz, MONDO_LOGFILE, lvremove_sz); 261 261 run_program_and_log_output(tmp1, 5); 262 262 mr_free(tmp1); … … 305 305 *q = '\0'; 306 306 log_msg(1, "Deleting old entries at /dev/%s", tmp); 307 mr_asprintf( &tmp1, "rm -Rf /dev/%s", tmp);307 mr_asprintf(tmp1, "rm -Rf /dev/%s", tmp); 308 308 run_program_and_log_output(tmp1, 1); 309 309 mr_free(tmp1); … … 335 335 log_it("%s... so I'll get creative.", tmp); 336 336 if (lvmversion == 2) { 337 mr_asprintf( &tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE);337 mr_asprintf(tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE); 338 338 strcpy(tmp, call_program_and_get_last_line_of_output(tmp1)); 339 339 mr_free(tmp1); 340 340 } else { 341 mr_asprintf( &tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE);341 mr_asprintf(tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE); 342 342 strcpy(tmp, call_program_and_get_last_line_of_output(tmp1)); 343 343 mr_free(tmp1); … … 393 393 retval++; 394 394 } 395 mr_asprintf( &tmp1, "echo \"%s\" >> /tmp/out.sh", command);395 mr_asprintf(tmp1, "echo \"%s\" >> /tmp/out.sh", command); 396 396 system(tmp1); 397 397 mr_free(tmp1); … … 484 484 fgets(incoming, MAX_STR_LEN - 1, fin)); 485 485 if (!feof(fin)) { 486 mr_asprintf( &tmp, "Investigating %s", old_mountlist->el[lino].device);486 mr_asprintf(tmp, "Investigating %s", old_mountlist->el[lino].device); 487 487 log_it(tmp); 488 488 mr_free(tmp); … … 497 497 *p = '\0'; 498 498 for (p--; p > incoming && *(p - 1) > 32; p--); 499 mr_asprintf( &tmp, "Extrapolating %s", p);499 mr_asprintf(tmp, "Extrapolating %s", p); 500 500 log_it(tmp); 501 501 mr_free(tmp); … … 518 518 new_mountlist->entries++; 519 519 } else { 520 mr_asprintf( &tmp, "Not adding %s to mountlist: it's already there", p);520 mr_asprintf(tmp, "Not adding %s to mountlist: it's already there", p); 521 521 log_it(tmp); 522 522 mr_free(tmp); … … 582 582 } 583 583 // create device list from normal disks followed by spare ones 584 mr_asprintf( &devices, "%s", raidlist->el[i].data_disks.el[0].device);584 mr_asprintf(devices, "%s", raidlist->el[i].data_disks.el[0].device); 585 585 for (j = 1; j < raidlist->el[i].data_disks.entries; j++) { 586 mr_asprintf( &strtmp, "%s", devices);586 mr_asprintf(strtmp, "%s", devices); 587 587 paranoid_free(devices); 588 mr_asprintf( &devices, "%s %s", strtmp,588 mr_asprintf(devices, "%s %s", strtmp, 589 589 raidlist->el[i].data_disks.el[j].device); 590 590 paranoid_free(strtmp); 591 591 } 592 592 for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) { 593 mr_asprintf( &strtmp, "%s", devices);593 mr_asprintf(strtmp, "%s", devices); 594 594 paranoid_free(devices); 595 mr_asprintf( &devices, "%s %s", strtmp,595 mr_asprintf(devices, "%s %s", strtmp, 596 596 raidlist->el[i].spare_disks.el[j].device); 597 597 paranoid_free(strtmp); … … 599 599 // translate RAID level 600 600 if (raidlist->el[i].raid_level == -2) { 601 mr_asprintf( &level, "multipath");601 mr_asprintf(level, "multipath"); 602 602 } else if (raidlist->el[i].raid_level == -1) { 603 mr_asprintf( &level, "linear");603 mr_asprintf(level, "linear"); 604 604 } else { 605 mr_asprintf( &level, "raid%d", raidlist->el[i].raid_level);605 mr_asprintf(level, "raid%d", raidlist->el[i].raid_level); 606 606 } 607 607 // create RAID device: … … 610 610 // - faulty devices ignored 611 611 // - persistent superblock always used as this is recommended 612 mr_asprintf( &program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries);612 mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries); 613 613 if (raidlist->el[i].parity != -1) { 614 mr_asprintf( &strtmp, "%s", program);614 mr_asprintf(strtmp, "%s", program); 615 615 paranoid_free(program); 616 616 switch(raidlist->el[i].parity) { 617 617 case 0: 618 mr_asprintf( &program, "%s --parity=%s", strtmp, "la");618 mr_asprintf(program, "%s --parity=%s", strtmp, "la"); 619 619 break; 620 620 case 1: 621 mr_asprintf( &program, "%s --parity=%s", strtmp, "ra");621 mr_asprintf(program, "%s --parity=%s", strtmp, "ra"); 622 622 break; 623 623 case 2: 624 mr_asprintf( &program, "%s --parity=%s", strtmp, "ls");624 mr_asprintf(program, "%s --parity=%s", strtmp, "ls"); 625 625 break; 626 626 case 3: 627 mr_asprintf( &program, "%s --parity=%s", strtmp, "rs");627 mr_asprintf(program, "%s --parity=%s", strtmp, "rs"); 628 628 break; 629 629 default: … … 634 634 } 635 635 if (raidlist->el[i].chunk_size != -1) { 636 mr_asprintf( &strtmp, "%s", program);636 mr_asprintf(strtmp, "%s", program); 637 637 paranoid_free(program); 638 mr_asprintf( &program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size);638 mr_asprintf(program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size); 639 639 paranoid_free(strtmp); 640 640 } 641 641 if (raidlist->el[i].spare_disks.entries > 0) { 642 mr_asprintf( &strtmp, "%s", program);642 mr_asprintf(strtmp, "%s", program); 643 643 paranoid_free(program); 644 mr_asprintf( &program, "%s --spare-devices=%d", strtmp, raidlist->el[i].spare_disks.entries);644 mr_asprintf(program, "%s --spare-devices=%d", strtmp, raidlist->el[i].spare_disks.entries); 645 645 paranoid_free(strtmp); 646 646 } 647 mr_asprintf( &strtmp, "%s", program);647 mr_asprintf(strtmp, "%s", program); 648 648 paranoid_free(program); 649 mr_asprintf( &program, "%s %s", strtmp, devices);649 mr_asprintf(program, "%s %s", strtmp, devices); 650 650 paranoid_free(strtmp); 651 651 res = run_program_and_log_output(program, 1); … … 688 688 689 689 if (strstr(format, "raid")) { // do not form RAID disks; do it to /dev/md* instead 690 mr_asprintf( &tmp, "Not formatting %s (it is a RAID disk)", device);690 mr_asprintf(tmp, "Not formatting %s (it is a RAID disk)", device); 691 691 log_it(tmp); 692 692 mr_free(tmp); … … 700 700 #endif 701 701 if (strlen(format) <= 2) { 702 mr_asprintf( &tmp, "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format);702 mr_asprintf(tmp, "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format); 703 703 log_it(tmp); 704 704 mr_free(tmp); … … 706 706 } 707 707 if (is_this_device_mounted(device)) { 708 mr_asprintf( &tmp, "%s is mounted - cannot format it ", device);708 mr_asprintf(tmp, "%s is mounted - cannot format it ", device); 709 709 log_to_screen(tmp); 710 710 mr_free(tmp); … … 736 736 char line[MAX_STR_LEN]; 737 737 738 mr_asprintf( &tmp, "Initializing Vinum device %s (this may take a *long* time)", device);738 mr_asprintf(tmp, "Initializing Vinum device %s (this may take a *long* time)", device); 739 739 log_to_screen(tmp); 740 740 mr_free(tmp); 741 741 742 742 /* format raid partition */ 743 mr_asprintf( &program, "for plex in `vinum lv -r %s | grep '^P' | tr '\t' ' ' | tr -s ' ' | cut -d' ' -f2`; do echo $plex; done > /tmp/plexes", basename(device));743 mr_asprintf(program, "for plex in `vinum lv -r %s | grep '^P' | tr '\t' ' ' | tr -s ' ' | cut -d' ' -f2`; do echo $plex; done > /tmp/plexes", basename(device)); 744 744 system(program); 745 745 if (g_fprep) { … … 753 753 *(strchr(line, '\n')) = '\0'; // get rid of the \n on the end 754 754 755 mr_asprintf( &tmp, "Initializing plex: %s", line);755 mr_asprintf(tmp, "Initializing plex: %s", line); 756 756 open_evalcall_form(tmp); 757 757 mr_free(tmp); 758 758 759 mr_asprintf( &tmp, "vinum init %s", line);759 mr_asprintf(tmp, "vinum init %s", line); 760 760 system(tmp); 761 761 mr_free(tmp); 762 762 763 763 while (1) { 764 mr_asprintf( &tmp, "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", line);764 mr_asprintf(tmp, "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", line); 765 765 FILE *pin = popen(tmp, "r"); 766 766 mr_free(tmp); … … 782 782 } 783 783 #else 784 mr_asprintf( &tmp, "Initializing RAID device %s", device);784 mr_asprintf(tmp, "Initializing RAID device %s", device); 785 785 log_to_screen(tmp); 786 786 mr_free(tmp); … … 798 798 log_msg(1, "Creating RAID device %s via mdadm returned %d", device, res); 799 799 } else { 800 mr_asprintf( &program, "mkraid --really-force %s", device);800 mr_asprintf(program, "mkraid --really-force %s", device); 801 801 res = run_program_and_log_output(program, 1); 802 802 log_msg(1, "%s returned %d", program, res); … … 822 822 } 823 823 program = which_format_command_do_i_need(format); 824 mr_asprintf( &tmp, "%s %s", program, device);824 mr_asprintf(tmp, "%s %s", program, device); 825 825 if (strstr(program, "kludge")) { 826 826 mr_strcat(tmp, " /"); … … 828 828 mr_free(program); 829 829 830 mr_asprintf( &program, "sh -c 'echo -en \"y\\ny\\ny\\n\" | %s'", tmp);830 mr_asprintf(program, "sh -c 'echo -en \"y\\ny\\ny\\n\" | %s'", tmp); 831 831 mr_free(tmp); 832 832 833 mr_asprintf( &tmp, "Formatting %s as %s", device, format);833 mr_asprintf(tmp, "Formatting %s as %s", device, format); 834 834 update_progress_form(tmp); 835 835 mr_free(tmp); … … 848 848 mr_free(program); 849 849 #ifdef __FreeBSD__ 850 mr_asprintf( &program, "newfs_msdos -F 32 %s", device);850 mr_asprintf(program, "newfs_msdos -F 32 %s", device); 851 851 #else 852 852 #ifdef __IA64__ 853 853 /* For EFI partitions take fat16 854 854 * as we want to make small ones */ 855 mr_asprintf( &program, "mkfs -t %s -F 16 %s", format, device);855 mr_asprintf(program, "mkfs -t %s -F 16 %s", format, device); 856 856 #else 857 mr_asprintf( &program, "mkfs -t %s -F 32 %s", format, device);857 mr_asprintf(program, "mkfs -t %s -F 32 %s", format, device); 858 858 #endif 859 859 #endif … … 911 911 912 912 assert(mountlist != NULL); 913 mr_asprintf( &tmp, "format_everything (mountlist, interactively = %s", (interactively) ? "true" : "false");913 mr_asprintf(tmp, "format_everything (mountlist, interactively = %s", (interactively) ? "true" : "false"); 914 914 log_it(tmp); 915 915 mr_free(tmp); … … 939 939 if (interactively) { 940 940 // ask user if we should format the current device 941 mr_asprintf( &tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint);941 mr_asprintf(tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint); 942 942 do_it = ask_me_yes_or_no(tmp); 943 943 mr_free(tmp); … … 989 989 me = &mountlist->el[lino]; // the current mountlist entry 990 990 if (!strcmp(me->mountpoint, "image")) { 991 mr_asprintf( &tmp, "Not formatting %s - it's an image", me->device);991 mr_asprintf(tmp, "Not formatting %s - it's an image", me->device); 992 992 log_it(tmp); 993 993 mr_free(tmp); 994 994 } else if (!strcmp(me->format, "raid")) { 995 mr_asprintf( &tmp, "Not formatting %s - it's a raid-let", me->device);995 mr_asprintf(tmp, "Not formatting %s - it's a raid-let", me->device); 996 996 log_it(tmp); 997 997 mr_free(tmp); 998 998 continue; 999 999 } else if (!strcmp(me->format, "lvm")) { 1000 mr_asprintf( &tmp, "Not formatting %s - it's an LVM", me->device);1000 mr_asprintf(tmp, "Not formatting %s - it's an LVM", me->device); 1001 1001 log_it(tmp); 1002 1002 mr_free(tmp); 1003 1003 continue; 1004 1004 } else if (!strncmp(me->device, "/dev/md", 7)) { 1005 mr_asprintf( &tmp, "Already formatted %s - it's a soft-RAID dev", me->device);1005 mr_asprintf(tmp, "Already formatted %s - it's a soft-RAID dev", me->device); 1006 1006 log_it(tmp); 1007 1007 mr_free(tmp); … … 1010 1010 && strncmp(me->device, "/dev/hd", 7) 1011 1011 && strncmp(me->device, "/dev/sd", 7)) { 1012 mr_asprintf( &tmp, "Not formatting %s yet - doesn't exist - probably an LVM", me->device);1012 mr_asprintf(tmp, "Not formatting %s yet - doesn't exist - probably an LVM", me->device); 1013 1013 log_it(tmp); 1014 1014 mr_free(tmp); … … 1017 1017 if (interactively) { 1018 1018 // ask user if we should format the current device 1019 mr_asprintf( &tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint);1019 mr_asprintf(tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint); 1020 1020 do_it = ask_me_yes_or_no(tmp); 1021 1021 mr_free(tmp); … … 1048 1048 } 1049 1049 1050 mr_asprintf( &tmp, "format_everything () - %s", (retval) ? "failed!" : "finished successfully");1050 mr_asprintf(tmp, "format_everything () - %s", (retval) ? "failed!" : "finished successfully"); 1051 1051 log_it(tmp); 1052 1052 mr_free(tmp); … … 1111 1111 1112 1112 if (devno_we_must_allow_for >= 5) { 1113 mr_asprintf( &tmp, "Making dummy primary 1 on %s", drivename);1113 mr_asprintf(tmp, "Making dummy primary 1 on %s", drivename); 1114 1114 log_it(tmp); 1115 1115 mr_free(tmp); … … 1127 1127 } 1128 1128 for (; current_devno < devno_we_must_allow_for; current_devno++) { 1129 mr_asprintf( &tmp, "Creating dummy partition %d on %s", current_devno, drivename);1129 mr_asprintf(tmp, "Creating dummy partition %d on %s", current_devno, drivename); 1130 1130 log_it(tmp); 1131 1131 mr_free(tmp); … … 1360 1360 for (c = 'a'; c <= 'z'; ++c) { 1361 1361 int idx; 1362 mr_asprintf( &subdev_str, "%s%c", drivename, c);1362 mr_asprintf(subdev_str, "%s%c", drivename, c); 1363 1363 if ((idx = find_device_in_mountlist(mountlist, subdev_str)) < 0) { 1364 1364 lp->d_partitions[c - 'a'].p_size = 0; … … 1416 1416 display_disklabel(ftmp, lp); 1417 1417 fclose(ftmp); 1418 mr_asprintf( &command, "disklabel -wr %s auto", canonical_name(drivename));1418 mr_asprintf(command, "disklabel -wr %s auto", canonical_name(drivename)); 1419 1419 retval += run_program_and_log_output(command, TRUE); 1420 1420 mr_free(command); 1421 1421 1422 mr_asprintf( &command, "disklabel -R %s /tmp/disklabel", canonical_name(drivename));1422 mr_asprintf(command, "disklabel -R %s /tmp/disklabel", canonical_name(drivename)); 1423 1423 retval += run_program_and_log_output(command, TRUE); 1424 1424 mr_free(command); … … 1468 1468 malloc_string(format); 1469 1469 1470 mr_asprintf( &tmp, "Partitioning drive %s", drivename);1470 mr_asprintf(tmp, "Partitioning drive %s", drivename); 1471 1471 log_it(tmp); 1472 1472 mr_free(tmp); … … 1477 1477 #else 1478 1478 make_hole_for_file(FDISK_LOG); 1479 mr_asprintf( &tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);1479 mr_asprintf(tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG); 1480 1480 pout_to_fdisk = popen(tmp, "w"); 1481 1481 mr_free(tmp); … … 1500 1500 // try DangerouslyDedicated mode 1501 1501 for (c = 'a'; c <= 'z'; c++) { 1502 mr_asprintf( &subdev_str, "%s%c", drivename, c);1502 mr_asprintf(subdev_str, "%s%c", drivename, c); 1503 1503 if (find_device_in_mountlist(mountlist, subdev_str) > 0) { 1504 1504 fbsd_part = TRUE; … … 1510 1510 drivename, 1511 1511 0); 1512 mr_asprintf( &command, "disklabel -B %s", basename(drivename));1512 mr_asprintf(command, "disklabel -B %s", basename(drivename)); 1513 1513 if (system(command)) { 1514 1514 log_to_screen … … 1522 1522 } 1523 1523 for (c = 'a'; c <= 'z'; c++) { 1524 mr_asprintf( &subdev_str, "%s%c", device_str, c);1524 mr_asprintf(subdev_str, "%s%c", device_str, c); 1525 1525 if (find_device_in_mountlist(mountlist, subdev_str) > 0) { 1526 1526 fbsd_part = TRUE; … … 1535 1535 partsize = 0; 1536 1536 for (i = 'a'; i < 'z'; ++i) { 1537 mr_asprintf( &subdev_str, "%s%c", device_str, i);1537 mr_asprintf(subdev_str, "%s%c", device_str, i); 1538 1538 line = find_device_in_mountlist(mountlist, subdev_str); 1539 1539 mr_free(subdev_str); … … 1565 1565 file = open(drivename, O_WRONLY); 1566 1566 if (file != -1) { 1567 mr_asprintf( &tmp, "Warning - unable to open %s for wiping it's partition table", drivename);1567 mr_asprintf(tmp, "Warning - unable to open %s for wiping it's partition table", drivename); 1568 1568 log_to_screen(tmp); 1569 1569 mr_free(tmp); … … 1572 1572 for (i = 0; i < 512; i++) { 1573 1573 if (!write(file, "\0", 1)) { 1574 mr_asprintf( &tmp, "Warning - unable to write to %s", drivename);1574 mr_asprintf(tmp, "Warning - unable to write to %s", drivename); 1575 1575 log_to_screen(tmp); 1576 1576 mr_free(tmp); … … 1618 1618 #ifdef __FreeBSD__ 1619 1619 if ((current_devno <= 4) && fbsd_part) { 1620 mr_asprintf( &tmp, "disklabel -B %s", basename(device_str));1620 mr_asprintf(tmp, "disklabel -B %s", basename(device_str)); 1621 1621 retval += label_drive_or_slice(mountlist, device_str, 0); 1622 1622 if (system(tmp)) { … … 1634 1634 if (pout_to_fdisk) { 1635 1635 // mark relevant partition as bootable 1636 mr_asprintf( &tmp, "a\n%s\n", call_program_and_get_last_line_of_output("make-me-bootable /tmp/mountlist.txt dummy"));1636 mr_asprintf(tmp, "a\n%s\n", call_program_and_get_last_line_of_output ("make-me-bootable /tmp/mountlist.txt dummy")); 1637 1637 fput_string_one_char_at_a_time(pout_to_fdisk, tmp); 1638 1638 mr_free(tmp); … … 1644 1644 log_msg(0, 1645 1645 "------------------- fdisk.log looks like this ------------------"); 1646 mr_asprintf( &tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE);1646 mr_asprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE); 1647 1647 system(tmp); 1648 1648 mr_free(tmp); … … 1650 1650 log_msg(0, 1651 1651 "------------------- end of fdisk.log... word! ------------------"); 1652 mr_asprintf( &tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG);1652 mr_asprintf(tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG); 1653 1653 if (!run_program_and_log_output(tmp, 5)) { 1654 1654 g_partition_table_locked_up++; … … 1656 1656 mr_free(tmp); 1657 1657 1658 mr_asprintf( &tmp, "partprobe %s", drivename);1658 mr_asprintf(tmp, "partprobe %s", drivename); 1659 1659 if (!run_program_and_log_output(tmp, 5)) { 1660 1660 g_partition_table_locked_up--; … … 1708 1708 1709 1709 if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) { 1710 mr_asprintf( &tmp, "Not partitioning %s - it is a virtual drive", drive);1710 mr_asprintf(tmp, "Not partitioning %s - it is a virtual drive", drive); 1711 1711 log_it(tmp); 1712 1712 mr_free(tmp); … … 1716 1716 partition_name = build_partition_name(drive, partno); 1717 1717 if (partsize <= 0) { 1718 mr_asprintf( &tmp, "Partitioning device %s (max size)", partition_name);1718 mr_asprintf(tmp, "Partitioning device %s (max size)", partition_name); 1719 1719 } else { 1720 mr_asprintf( &tmp, "Partitioning device %s (%lld MB)", partition_name, (long long) partsize / 1024);1720 mr_asprintf(tmp, "Partitioning device %s (%lld MB)", partition_name, (long long) partsize / 1024); 1721 1721 } 1722 1722 update_progress_form(tmp); … … 1725 1725 1726 1726 if (is_this_device_mounted(partition_name)) { 1727 mr_asprintf( &tmp, "%s is mounted, and should not be partitioned", partition_name);1727 mr_asprintf(tmp, "%s is mounted, and should not be partitioned", partition_name); 1728 1728 log_to_screen(tmp); 1729 1729 mr_free(tmp); … … 1737 1737 /* BERLIOS: should not be called each time */ 1738 1738 part_table_fmt = which_partition_format(drive); 1739 mr_asprintf( &output, "");1739 mr_asprintf(output, ""); 1740 1740 /* make it a primary/extended/logical */ 1741 1741 if (partno <= 4) { … … 1769 1769 } 1770 1770 mr_strcat(output, "\n"); 1771 mr_asprintf( &tmp,"PARTSIZE = +%ld",(long)partsize);1771 mr_asprintf(tmp,"PARTSIZE = +%ld",(long)partsize); 1772 1772 log_it(tmp); 1773 1773 mr_free(tmp); … … 1777 1777 log_it("---end of fdisk---"); 1778 1778 1779 mr_asprintf( &program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE);1779 mr_asprintf(program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE); 1780 1780 if (pout_to_fdisk) { 1781 1781 log_msg(1, "Doing the new all-in-one fdisk thing"); … … 1783 1783 fput_string_one_char_at_a_time(pout_to_fdisk, output); 1784 1784 fput_string_one_char_at_a_time(pout_to_fdisk, "\n\np\n"); 1785 mr_asprintf( &tmp, "%s", last_line_of_file(FDISK_LOG));1785 mr_asprintf(tmp, "%s", last_line_of_file(FDISK_LOG)); 1786 1786 if (strstr(tmp, " (m ")) { 1787 1787 log_msg(1, "Successfully created partition %d on %s", partno, drive); … … 1826 1826 format, -1); 1827 1827 if (res) { 1828 mr_asprintf( &tmp, "Failed to vacuum-pack %s", partition_name);1828 mr_asprintf(tmp, "Failed to vacuum-pack %s", partition_name); 1829 1829 log_it(tmp); 1830 1830 mr_free(tmp); … … 1840 1840 partsize); 1841 1841 if (retval) { 1842 mr_asprintf( &tmp, "Partitioned %s but failed to set its type", partition_name);1842 mr_asprintf(tmp, "Partitioned %s but failed to set its type", partition_name); 1843 1843 log_it(tmp); 1844 1844 mr_free(tmp); 1845 1845 } else { 1846 1846 if (partsize > 0) { 1847 mr_asprintf( &tmp, "Partition %s created+configured OK", partition_name);1847 mr_asprintf(tmp, "Partition %s created+configured OK", partition_name); 1848 1848 log_to_screen(tmp); 1849 1849 mr_free(tmp); … … 1853 1853 } 1854 1854 } else { 1855 mr_asprintf( &tmp, "Failed to partition %s", partition_name);1855 mr_asprintf(tmp, "Failed to partition %s", partition_name); 1856 1856 if (partsize > 0) { 1857 1857 log_to_screen(tmp); … … 1997 1997 p = (char *) strrchr(partition, '/'); 1998 1998 if (strcmp(format, "swap") == 0) { 1999 mr_asprintf( &partcode, "82");1999 mr_asprintf(partcode, "82"); 2000 2000 } else if (strcmp(format, "vfat") == 0) { 2001 2001 if (partsize / 1024 > 8192) { 2002 mr_asprintf( &partcode, "c");2002 mr_asprintf(partcode, "c"); 2003 2003 } else { 2004 mr_asprintf( &partcode, "b");2004 mr_asprintf(partcode, "b"); 2005 2005 } 2006 2006 } else if (strcmp(format, "ext2") == 0 … … 2010 2010 || strcmp(format, "xfs") == 0 2011 2011 || strcmp(format, "jfs") == 0) { 2012 mr_asprintf( &partcode, "83");2012 mr_asprintf(partcode, "83"); 2013 2013 } else if (strcmp(format, "minix") == 0) { 2014 mr_asprintf( &partcode, "81");2014 mr_asprintf(partcode, "81"); 2015 2015 } else if (strcmp(format, "vmfs3") == 0) { 2016 mr_asprintf( &partcode, "fb");2016 mr_asprintf(partcode, "fb"); 2017 2017 } else if (strcmp(format, "vmkcore") == 0) { 2018 mr_asprintf( &partcode, "fc");2018 mr_asprintf(partcode, "fc"); 2019 2019 } else if (strcmp(format, "raid") == 0) { 2020 mr_asprintf( &partcode, "fd");2020 mr_asprintf(partcode, "fd"); 2021 2021 } else if (strcmp(format, "ntfs") == 0) { 2022 mr_asprintf( &partcode, "7");2022 mr_asprintf(partcode, "7"); 2023 2023 } else if ((strcmp(format, "ufs") == 0) 2024 2024 || (strcmp(format, "ffs") == 0)) { /* raid autodetect */ 2025 mr_asprintf( &partcode, "a5");2025 mr_asprintf(partcode, "a5"); 2026 2026 } else if (strcmp(format, "lvm") == 0) { 2027 mr_asprintf( &partcode, "8e");2027 mr_asprintf(partcode, "8e"); 2028 2028 } else if (format[0] == '\0') { /* LVM physical partition */ 2029 mr_asprintf( &partcode, "");2029 mr_asprintf(partcode, ""); 2030 2030 } else if (strlen(format) >= 1 && strlen(format) <= 2) { 2031 mr_asprintf( &partcode, format);2031 mr_asprintf(partcode, format); 2032 2032 } else { 2033 2033 /* probably an image */ 2034 mr_asprintf( &tmp, "Unknown format ('%s') - using supplied string anyway", format);2034 mr_asprintf(tmp, "Unknown format ('%s') - using supplied string anyway", format); 2035 2035 mvaddstr_and_log_it(g_currentY++, 0, tmp); 2036 2036 mr_free(tmp); 2037 2037 #ifdef __FreeBSD__ 2038 mr_asprintf( &partcode, format); // was a52038 mr_asprintf(partcode, format); // was a5 2039 2039 #else 2040 mr_asprintf( &partcode, format); // was 832040 mr_asprintf(partcode, format); // was 83 2041 2041 #endif 2042 2042 } … … 2052 2052 || strstr(last_line_of_file(FDISK_LOG), " (1-4)")) { 2053 2053 log_msg(5, "Specifying partno (%d) - yay", partno); 2054 mr_asprintf( &tmp, "%d\n", partno);2054 mr_asprintf(tmp, "%d\n", partno); 2055 2055 fput_string_one_char_at_a_time(pout_to_fdisk, tmp); 2056 2056 mr_free(tmp); … … 2060 2060 } 2061 2061 2062 mr_asprintf( &tmp, "%s\n", partcode);2062 mr_asprintf(tmp, "%s\n", partcode); 2063 2063 fput_string_one_char_at_a_time(pout_to_fdisk, tmp); 2064 2064 mr_free(tmp); … … 2070 2070 last_line_of_file(FDISK_LOG)); 2071 2071 2072 mr_asprintf( &tmp, "%s", last_line_of_file(FDISK_LOG));2072 mr_asprintf(tmp, "%s", last_line_of_file(FDISK_LOG)); 2073 2073 if (!strstr(tmp, " (m ")) { 2074 2074 log_msg(1, "last line = '%s'; part type set failed", tmp); … … 2080 2080 fput_string_one_char_at_a_time(pout_to_fdisk, "p\n"); 2081 2081 } else { 2082 mr_asprintf( &output, "t\n%d\n%s\nw\n", partno, partcode);2083 mr_asprintf( &command, "parted2fdisk %s >> %s 2>> %s", drive,2082 mr_asprintf(output, "t\n%d\n%s\nw\n", partno, partcode); 2083 mr_asprintf(command, "parted2fdisk %s >> %s 2>> %s", drive, 2084 2084 MONDO_LOGFILE, MONDO_LOGFILE); 2085 2085 log_msg(5, "output = '%s'", output); … … 2123 2123 return 1; 2124 2124 } 2125 mr_asprintf( &program, "vinum start -f %s", raid_device);2125 mr_asprintf(program, "vinum start -f %s", raid_device); 2126 2126 #else 2127 mr_asprintf( &program, "raidstart %s", raid_device);2127 mr_asprintf(program, "raidstart %s", raid_device); 2128 2128 #endif 2129 2129 log_msg(1, "program = %s", program); … … 2168 2168 return 1; 2169 2169 } 2170 mr_asprintf( &program, "vinum stop -f %s", raid_device);2170 mr_asprintf(program, "vinum stop -f %s", raid_device); 2171 2171 #else 2172 2172 // use raidstop if it exists, otherwise use mdadm 2173 2173 if (run_program_and_log_output("which raidstop", FALSE)) { 2174 mr_asprintf( &program, "mdadm -S %s", raid_device);2174 mr_asprintf(program, "mdadm -S %s", raid_device); 2175 2175 } else { 2176 mr_asprintf( &program, "raidstop %s", raid_device);2176 mr_asprintf(program, "raidstop %s", raid_device); 2177 2177 } 2178 2178 #endif … … 2320 2320 if (strcmp(format, "swap") == 0) { 2321 2321 #ifdef __FreeBSD__ 2322 mr_asprintf( &program, "true");2322 mr_asprintf(program, "true"); 2323 2323 #else 2324 mr_asprintf( &program, "mkswap");2324 mr_asprintf(program, "mkswap"); 2325 2325 #endif 2326 2326 } else if (strcmp(format, "vfat") == 0) { 2327 mr_asprintf( &program, "format-and-kludge-vfat");2327 mr_asprintf(program, "format-and-kludge-vfat"); 2328 2328 #ifndef __FreeBSD__ 2329 2329 } else if (strcmp(format, "reiserfs") == 0) { 2330 mr_asprintf( &program, "mkreiserfs -ff");2330 mr_asprintf(program, "mkreiserfs -ff"); 2331 2331 } else if (strcmp(format, "xfs") == 0) { 2332 mr_asprintf( &program, "mkfs.xfs -f -q");2332 mr_asprintf(program, "mkfs.xfs -f -q"); 2333 2333 } else if (strcmp(format, "jfs") == 0) { 2334 mr_asprintf( &program, "mkfs.jfs");2334 mr_asprintf(program, "mkfs.jfs"); 2335 2335 } else if (strcmp(format, "ext3") == 0) { 2336 mr_asprintf( &program, "mkfs -t ext3 -F -q");2336 mr_asprintf(program, "mkfs -t ext3 -F -q"); 2337 2337 } else if (strcmp(format, "ext4") == 0) { 2338 mr_asprintf( &program, "mkfs -t ext4 -F -q");2338 mr_asprintf(program, "mkfs -t ext4 -F -q"); 2339 2339 } else if (strcmp(format, "minix") == 0) { 2340 mr_asprintf( &program, "mkfs.minix");2340 mr_asprintf(program, "mkfs.minix"); 2341 2341 } else if (strcmp(format, "vmfs") == 0) { 2342 mr_asprintf( &program, "mkfs -t vmfs");2342 mr_asprintf(program, "mkfs -t vmfs"); 2343 2343 } else if (strcmp(format, "ntfs") == 0) { 2344 2344 /* … … 2346 2346 * so the default "mkfs -t %s -c" command structure fails 2347 2347 */ 2348 mr_asprintf( &program, "mkfs -t ntfs");2348 mr_asprintf(program, "mkfs -t ntfs"); 2349 2349 } else if (strcmp(format, "ocfs2") == 0) { 2350 2350 /* … … 2352 2352 * 2353 2353 */ 2354 mr_asprintf( &program, "mkfs -t ocfs2 -F");2354 mr_asprintf(program, "mkfs -t ocfs2 -F"); 2355 2355 #endif 2356 2356 } else if (strcmp(format, "ext2") == 0) { 2357 mr_asprintf( &program, "mke2fs -F -q");2357 mr_asprintf(program, "mke2fs -F -q"); 2358 2358 } else { 2359 2359 #ifdef __FreeBSD__ 2360 mr_asprintf( &program, "newfs_%s", format);2360 mr_asprintf(program, "newfs_%s", format); 2361 2361 #else 2362 mr_asprintf( &program, "mkfs -t %s -c", format); // -c checks for bad blocks2363 #endif 2364 mr_asprintf( &tmp, "Unknown format (%s) - assuming '%s' will do", format, program);2362 mr_asprintf(program, "mkfs -t %s -c", format); // -c checks for bad blocks 2363 #endif 2364 mr_asprintf(tmp, "Unknown format (%s) - assuming '%s' will do", format, program); 2365 2365 log_it(tmp); 2366 2366 mr_free(tmp); … … 2425 2425 return; 2426 2426 } 2427 mr_asprintf( &tmp, "Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive);2427 mr_asprintf(tmp, "Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive); 2428 2428 log_to_screen(tmp); 2429 2429 mr_free(tmp); … … 2445 2445 2446 2446 if (original_size_of_drive <= 0) { 2447 mr_asprintf( &tmp, "Cannot resize %s's entries. Drive not found.", drive_name);2447 mr_asprintf(tmp, "Cannot resize %s's entries. Drive not found.", drive_name); 2448 2448 log_to_screen(tmp); 2449 2449 mr_free(tmp); … … 2451 2451 } 2452 2452 factor = (float) (current_size_of_drive) / (float) (original_size_of_drive); 2453 mr_asprintf( &tmp, "Disk %s was %ld MB; is now %ld MB; factor = %f", drive_name, original_size_of_drive, current_size_of_drive, factor);2453 mr_asprintf(tmp, "Disk %s was %ld MB; is now %ld MB; factor = %f", drive_name, original_size_of_drive, current_size_of_drive, factor); 2454 2454 log_to_screen(tmp); 2455 2455 mr_free(tmp); … … 2478 2478 } 2479 2479 2480 mr_asprintf( &tmp, "Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);2480 mr_asprintf(tmp, "Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL); 2481 2481 log_to_screen(tmp); 2482 2482 mr_free(tmp); … … 2484 2484 } 2485 2485 final_size = get_phys_size_of_drive(drive_name); 2486 mr_asprintf( &tmp, "final_size = %ld MB", final_size);2486 mr_asprintf(tmp, "final_size = %ld MB", final_size); 2487 2487 log_to_screen(tmp); 2488 2488 mr_free(tmp); -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c
r2321 r2323 79 79 insist_on_this_cd_number((++g_current_media_number)); 80 80 } else { 81 mr_asprintf( &tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob.");81 mr_asprintf(tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob."); 82 82 log_msg(2, tmp_ptr); 83 83 paranoid_free(tmp_ptr); … … 86 86 } 87 87 if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) { 88 mr_asprintf( &tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr);88 mr_asprintf(tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr); 89 89 log_to_screen(tmp_ptr); 90 90 paranoid_free(tmp_ptr); … … 101 101 102 102 if (!g_text_mode) { 103 mr_asprintf( &tmp_ptr, "Comparing %s", bigfile_fname_ptr);103 mr_asprintf(tmp_ptr, "Comparing %s", bigfile_fname_ptr); 104 104 newtDrawRootText(0, 22, tmp_ptr); 105 105 paranoid_free(tmp_ptr); … … 120 120 mr_free(command_ptr); 121 121 122 mr_asprintf( &tmp_ptr, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);122 mr_asprintf(tmp_ptr, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE); 123 123 paranoid_system(tmp_ptr); 124 124 paranoid_free(tmp_ptr); … … 146 146 } 147 147 } 148 mr_asprintf( &tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr);148 mr_asprintf(tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr); 149 149 if (!strcmp(checksum_ptr, original_cksum_ptr) != 0) { 150 150 mr_strcat(tmp_ptr, " ... OK"); … … 274 274 275 275 if (use_star) { 276 mr_asprintf( &archiver_exe, "star");277 } else { 278 mr_asprintf( &archiver_exe, "afio");276 mr_asprintf(archiver_exe, "star"); 277 } else { 278 mr_asprintf(archiver_exe, "afio"); 279 279 } 280 280 -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-newt.c
r2316 r2323 472 472 char *prompt = NULL; 473 473 474 mr_asprintf( &prompt, "Please enter the RAID level you want. (concat, striped, raid5)");474 mr_asprintf(prompt, "Please enter the RAID level you want. (concat, striped, raid5)"); 475 475 if (raidrec->raidlevel == -1) { 476 mr_asprintf( &tmp, "concat");476 mr_asprintf(tmp, "concat"); 477 477 } else if (raidrec->raidlevel == 0) { 478 mr_asprintf( &tmp, "striped");478 mr_asprintf(tmp, "striped"); 479 479 } else { 480 mr_asprintf( &tmp, "raid%i", raidrec->raidlevel);480 mr_asprintf(tmp, "raid%i", raidrec->raidlevel); 481 481 } 482 482 for (out = 999; out == 999;) { … … 538 538 539 539 system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null"); 540 mr_asprintf( &personalities, "%s", last_line_of_file("/tmp/raid-personalities.txt"));541 mr_asprintf( &prompt, "Please enter the RAID level you want. %s", personalities);540 mr_asprintf(personalities, "%s", last_line_of_file("/tmp/raid-personalities.txt")); 541 mr_asprintf(prompt, "Please enter the RAID level you want. %s", personalities); 542 542 mr_free(personalities); 543 543 544 544 if (raidrec->raid_level == -1) { 545 mr_asprintf( &tmp, "linear");545 mr_asprintf(tmp, "linear"); 546 546 } else { 547 mr_asprintf( &tmp, "%d", raidrec->raid_level);547 mr_asprintf(tmp, "%d", raidrec->raid_level); 548 548 } 549 549 for (out = 999; … … 1850 1850 char *tmp = NULL; 1851 1851 1852 mr_asprintf( &tmp, "%i", raidrec->stripesize);1852 mr_asprintf(tmp, "%i", raidrec->stripesize); 1853 1853 p = popup_and_get_string("Stripe size", "Please enter the stripe size in kilobytes.", tmp); 1854 1854 mr_free(tmp); … … 1899 1899 assert(lino >= 0); 1900 1900 1901 mr_asprintf( &sz_out, "%s", raidrec->additional_vars.el[lino].value);1902 mr_asprintf( &header, "Edit %s", raidrec->additional_vars.el[lino].label);1903 mr_asprintf( &comment, "Please set %s's value (currently '%s')", raidrec->additional_vars.el[lino].label, sz_out);1901 mr_asprintf(sz_out, "%s", raidrec->additional_vars.el[lino].value); 1902 mr_asprintf(header, "Edit %s", raidrec->additional_vars.el[lino].label); 1903 mr_asprintf(comment, "Please set %s's value (currently '%s')", raidrec->additional_vars.el[lino].label, sz_out); 1904 1904 p = popup_and_get_string(header, comment, sz_out); 1905 1905 if (p != NULL) { … … 1957 1957 assert(raidlist != NULL); 1958 1958 1959 mr_asprintf( &flaws_str_A, "%s", " ");1960 mr_asprintf( &flaws_str_B, "%s", " ");1961 mr_asprintf( &flaws_str_C, "%s", " ");1959 mr_asprintf(flaws_str_A, "%s", " "); 1960 mr_asprintf(flaws_str_B, "%s", " "); 1961 mr_asprintf(flaws_str_C, "%s", " "); 1962 1962 if (mountlist->entries > ARBITRARY_MAXIMUM) { 1963 1963 log_to_screen("Arbitrary limits suck, man!"); … … 2283 2283 log_it("isodir_path = %s", isodir_path); 2284 2284 if (isodir_device[0] == '\0') { 2285 mr_asprintf( &idev, "/dev/");2285 mr_asprintf(idev, "/dev/"); 2286 2286 } else { 2287 mr_asprintf(&idev, "%s", isodir_device); 2288 } 2289 2290 if (isodir_path[0] == '\0') { 2291 strcpy(isodir_path, "/"); 2292 } 2287 mr_asprintf(idev, "%s", isodir_device); 2288 } 2289 2293 2290 if (does_file_exist("/tmp/NFS-SERVER-PATH")) { 2294 2291 mr_free(idev); 2295 mr_asprintf(&idev, "%s", last_line_of_file("/tmp/NFS-SERVER-MOUNT")); 2296 mr_asprintf(&isodir_format, "nfs"); 2297 strcpy(isodir_path, last_line_of_file("/tmp/NFS-SERVER-PATH")); 2292 mr_asprintf(idev, "%s", last_line_of_file("/tmp/NFS-SERVER-MOUNT")); 2293 mr_asprintf(isodir_format, "nfs"); 2294 mr_free(isodir_path); 2295 mr_asprintf(isodir_path, "%s", last_line_of_file("/tmp/NFS-SERVER-PATH")); 2298 2296 } 2299 2297 … … 2319 2317 /* modify for the caller */ 2320 2318 strcpy(isodir_device, p); 2321 strcpy(isodir_path, r); 2319 mr_free(isodir_path); 2320 isodir_path = r; 2322 2321 log_it("isodir_device = %s - isodir_format = %s - isodir_path = %s", isodir_device, isodir_format, isodir_path); 2323 mr_free(r);2324 2322 2325 2323 ret = TRUE; … … 2770 2768 2771 2769 log_it("Post-malloc"); 2772 mr_asprintf( &help_text, " Edit this RAID device's list of partitions. Choose OK or Cancel when done.");2773 mr_asprintf( &header_text, "%-24s %s", "Device", "Index");2774 mr_asprintf( &title_of_window, "%s contains...", raidrec->raid_device);2770 mr_asprintf(help_text, " Edit this RAID device's list of partitions. Choose OK or Cancel when done."); 2771 mr_asprintf(header_text, "%-24s %s", "Device", "Index"); 2772 mr_asprintf(title_of_window, "%s contains...", raidrec->raid_device); 2775 2773 newtPushHelpLine(help_text); 2776 2774 for (b_res = (newtComponent) 12345; b_res != bOK && b_res != bCancel;) { … … 2827 2825 redraw_disklist(disklist, keylist, partitionsListbox); 2828 2826 } else { 2829 mr_asprintf( &tmp, "%s's index is %d. What should it be?", raidrec->raid_device, disklist->el[currline].index);2830 mr_asprintf( &sz_res, "%d", disklist->el[currline].index);2827 mr_asprintf(tmp, "%s's index is %d. What should it be?", raidrec->raid_device, disklist->el[currline].index); 2828 mr_asprintf(sz_res, "%d", disklist->el[currline].index); 2831 2829 p = popup_and_get_string("Set index", tmp, sz_res); 2832 2830 mr_free(tmp); -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2322 r2323 144 144 } 145 145 146 mr_asprintf( &question_ptr, "Should I restore the image of %s ?", incoming_ptr);146 mr_asprintf(question_ptr, "Should I restore the image of %s ?", incoming_ptr); 147 147 148 148 if (ask_me_yes_or_no(question_ptr)) { … … 228 228 } 229 229 log_msg(2, "Checking to see if f=%s, file=%s, is in the list of biggiefiles", f, file); 230 mr_asprintf( &command, "grep -E '^%s$' %s", file, list_fname);230 mr_asprintf(command, "grep -E '^%s$' %s", file, list_fname); 231 231 res = run_program_and_log_output(command, FALSE); 232 232 mr_free(command); … … 260 260 char *command = NULL; 261 261 char *mds = NULL; 262 char *p = NULL; 262 263 int retval = 0, i; 263 264 bool already_mounted = FALSE; 264 265 char *isodir_format = NULL; 265 266 266 assert(bkpinfo != NULL);267 267 g_ISO_restore_mode = TRUE; 268 268 read_cfg_var(g_mondo_cfg_file, "iso-dev", g_isodir_device); … … 271 271 * Don't let this clobber an existing bkpinfo->isodir */ 272 272 if (!bkpinfo->isodir[0]) { 273 strcpy(bkpinfo->isodir, "/tmp/isodir"); 273 mr_free(bkpinfo->isodir); 274 mr_asprintf(p, "/tmp/isodir"); 275 bkpinfo->isodir = p; 274 276 } 275 277 /* End patch */ 276 mr_asprintf( &command, "mkdir -p %s", bkpinfo->isodir);278 mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir); 277 279 run_program_and_log_output(command, 5); 278 280 mr_free(command); … … 290 292 already_mounted = TRUE; 291 293 } else { 292 mr_asprintf( &mount_isodir_command, "mount %s", g_isodir_device);294 mr_asprintf(mount_isodir_command, "mount %s", g_isodir_device); 293 295 if (isodir_format) { 294 296 mr_strcat(mount_isodir_command, " -t %s", isodir_format); … … 320 322 log_msg(1, "%s #%d has been mounted via loopback mount", mds, i); 321 323 if (i < 0) { 322 popup_and_OK 323 ("Cannot find ISO images in the directory you specified."); 324 retval = 1; 325 } 326 log_msg(2, "%ld: bkpinfo->isodir is now %s", __LINE__, 327 bkpinfo->isodir); 324 popup_and_OK("Cannot find ISO images in the directory you specified."); 325 retval = 1; 326 } 327 log_msg(2, "bkpinfo->isodir is now %s", bkpinfo->isodir); 328 328 return (retval); 329 329 } … … 368 368 369 369 if (!strcmp(mpt, "/1")) { 370 mr_asprintf( &mountpoint, "/");370 mr_asprintf(mountpoint, "/"); 371 371 log_msg(3, "Mommm! SME is being a dildo!"); 372 372 } else { 373 mr_asprintf( &mountpoint, "%s", mpt);373 mr_asprintf(mountpoint, "%s", mpt); 374 374 } 375 375 … … 380 380 return (0); 381 381 } 382 mr_asprintf( &tmp, "Mounting device %s ", device);382 mr_asprintf(tmp, "Mounting device %s ", device); 383 383 log_msg(1, tmp); 384 384 /* Deal with additional params only if not /proc or /sys */ 385 mr_asprintf( &additional_parameters, "");385 mr_asprintf(additional_parameters, ""); 386 386 if (strcmp(format, "proc") && strcmp(format, "sys")) { 387 387 if (writeable) { … … 399 399 400 400 if (!strcmp(mountpoint, "swap")) { 401 mr_asprintf( &command, "swapon %s", device);402 mr_asprintf( &mountdir, "swap");401 mr_asprintf(command, "swapon %s", device); 402 mr_asprintf(mountdir, "swap"); 403 403 } else { 404 404 if (!strcmp(mountpoint, "/")) { 405 mr_asprintf( &mountdir, "%s", MNT_RESTORING);405 mr_asprintf(mountdir, "%s", MNT_RESTORING); 406 406 } else { 407 mr_asprintf( &mountdir, "%s%s", MNT_RESTORING, mountpoint);408 } 409 mr_asprintf( &command, "mkdir -p %s", mountdir);407 mr_asprintf(mountdir, "%s%s", MNT_RESTORING, mountpoint); 408 } 409 mr_asprintf(command, "mkdir -p %s", mountdir); 410 410 run_program_and_log_output(command, FALSE); 411 411 mr_free(command); 412 412 413 mr_asprintf( &command, "mount -t %s %s %s %s 2>> %s", format, device, additional_parameters, mountdir, MONDO_LOGFILE);413 mr_asprintf(command, "mount -t %s %s %s %s 2>> %s", format, device, additional_parameters, mountdir, MONDO_LOGFILE); 414 414 log_msg(2, "command='%s'", command); 415 415 } … … 420 420 log_msg(1, "Re-trying without the fancy extra parameters"); 421 421 mr_free(command); 422 mr_asprintf( &command, "mount -t %s %s %s 2>> %s", format, device, mountdir, MONDO_LOGFILE);422 mr_asprintf(command, "mount -t %s %s %s 2>> %s", format, device, mountdir, MONDO_LOGFILE); 423 423 res = run_program_and_log_output(command, TRUE); 424 424 } … … 432 432 log_msg(2, "Retrying w/o the '-t' switch"); 433 433 mr_free(command); 434 mr_asprintf( &command, "mount %s %s 2>> %s", device, mountdir, MONDO_LOGFILE);434 mr_asprintf(command, "mount %s %s 2>> %s", device, mountdir, MONDO_LOGFILE); 435 435 log_msg(2, "2nd command = '%s'", command); 436 436 res = run_program_and_log_output(command, TRUE); … … 492 492 "", mountlist->entries); 493 493 494 mr_asprintf( &these_failed, "");494 mr_asprintf(these_failed, ""); 495 495 for (lino = 0; lino < mountlist->entries; lino++) { 496 496 if (!strcmp(mountlist->el[lino].device, "/proc")) { … … 498 498 "Again with the /proc - why is this in your mountlist?"); 499 499 } else if (is_this_device_mounted(mountlist->el[lino].device)) { 500 mr_asprintf( &tmp, "%s is already mounted", mountlist->el[lino].device);500 mr_asprintf(tmp, "%s is already mounted", mountlist->el[lino].device); 501 501 log_to_screen(tmp); 502 502 mr_free(tmp); … … 505 505 && strcmp(mountlist->el[lino].mountpoint, "raid") 506 506 && strcmp(mountlist->el[lino].mountpoint, "image")) { 507 mr_asprintf( &tmp, "Mounting %s", mountlist->el[lino].device);507 mr_asprintf(tmp, "Mounting %s", mountlist->el[lino].device); 508 508 update_progress_form(tmp); 509 509 mr_free(tmp); … … 529 529 ("format and restore *without* partitioning first. Sorry for the inconvenience."); 530 530 } 531 mr_asprintf( &tmp, "Could not mount device(s) %s- shall I abort?", these_failed);531 mr_asprintf(tmp, "Could not mount device(s) %s- shall I abort?", these_failed); 532 532 533 533 if (!ask_me_yes_or_no(tmp)) { … … 570 570 * @return 0 for success, nonzero for failure. 571 571 */ 572 int mount_media() 573 { 574 char *mount_cmd = NULL; 575 int i, res; 572 int mount_media() { 573 574 char *mount_cmd = NULL; 575 char *p = NULL; 576 int i, res; 576 577 #ifdef __FreeBSD__ 577 char mdd[32];578 char *mddev = mdd;578 char mdd[32]; 579 char *mddev = mdd; 579 580 #endif 580 581 581 assert(bkpinfo != NULL); 582 583 if (bkpinfo->backup_media_type == tape 584 || bkpinfo->backup_media_type == udev) { 582 if (bkpinfo->backup_media_type == tape || bkpinfo->backup_media_type == udev) { 585 583 log_msg(8, "Tape/udev. Therefore, no need to mount a media."); 586 584 return 0; … … 595 593 log_msg(2, "Mounting for NFS thingy"); 596 594 log_msg(2, "isodir = %s", bkpinfo->isodir); 597 if ((!bkpinfo->isodir[0] || !strcmp(bkpinfo->isodir, "/")) 598 && am_I_in_disaster_recovery_mode()) { 599 strcpy(bkpinfo->isodir, "/tmp/isodir"); 595 if (!strcmp(bkpinfo->isodir, "/") && am_I_in_disaster_recovery_mode()) { 596 mr_free(bkpinfo->isodir); 597 mr_asprintf(p, "/tmp/isodir"); 598 bkpinfo->isodir = p; 600 599 log_msg(1, "isodir is being set to %s", bkpinfo->isodir); 601 600 } 602 601 #ifdef __FreeBSD__ 603 mr_asprintf( &mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);602 mr_asprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number); 604 603 mddev = make_vn(mount_cmd); 605 604 mr_free(mount_cmd); 606 605 607 mr_asprintf( &mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev);606 mr_asprintf(mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev); 608 607 #else 609 mr_asprintf( &mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);608 mr_asprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM); 610 609 #endif 611 610 612 611 } else if (bkpinfo->backup_media_type == iso) { 613 612 #ifdef __FreeBSD__ 614 mr_asprintf( &mount_cmd, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number);613 mr_asprintf(mount_cmd, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number); 615 614 mddev = make_vn(mount_cmd); 616 615 mr_free(mount_cmd); 617 616 618 mr_asprintf( &mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM);617 mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM); 619 618 #else 620 mr_asprintf( &mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);619 mr_asprintf(mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM); 621 620 #endif 622 621 } else if (bkpinfo->backup_media_type == usb) { 623 mr_asprintf( &mount_cmd, "mount -t vfat %s %s", bkpinfo->media_device, MNT_CDROM);622 mr_asprintf(mount_cmd, "mount -t vfat %s %s", bkpinfo->media_device, MNT_CDROM); 624 623 } else if (strstr(bkpinfo->media_device, "/dev/")) { 625 624 #ifdef __FreeBSD__ 626 mr_asprintf( &mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM);625 mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM); 627 626 #else 628 mr_asprintf( &mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM);627 mr_asprintf(mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM); 629 628 #endif 630 629 } else { … … 638 637 639 638 #ifdef __FreeBSD__ 640 mr_asprintf( &mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM);639 mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM); 641 640 #else 642 mr_asprintf( &mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM);641 mr_asprintf(mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM); 643 642 #endif 644 643 } … … 727 726 malloc_string(iso_mnt); 728 727 malloc_string(iso_path); 729 malloc_string(old_isodir);730 728 malloc_string(value); 731 729 malloc_string(tmp); … … 774 772 mr_free(bkpinfo->prefix); 775 773 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 776 mr_asprintf( &tmp1, "%s", value);774 mr_asprintf(tmp1, "%s", value); 777 775 } else { 778 mr_asprintf( &tmp1, "%s", STD_PREFIX);776 mr_asprintf(tmp1, "%s", STD_PREFIX); 779 777 } 780 778 bkpinfo->prefix = tmp1; … … 784 782 mr_free(bkpinfo->prefix); 785 783 if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) { 786 mr_asprintf( &tmp1, "%s", value);784 mr_asprintf(tmp1, "%s", value); 787 785 } else { 788 mr_asprintf( &tmp1, "%s", STD_PREFIX);786 mr_asprintf(tmp1, "%s", STD_PREFIX); 789 787 } 790 788 bkpinfo->prefix = tmp1; … … 798 796 } 799 797 mr_free(bkpinfo->prefix); 800 mr_asprintf( &tmp1, "%s", envtmp1);798 mr_asprintf(tmp1, "%s", envtmp1); 801 799 bkpinfo->prefix = tmp1; 802 800 } … … 863 861 read_cfg_var(cfg_file, "acl", value); 864 862 if (strstr(value, "TRUE")) { 865 mr_asprintf( &g_getfacl,"setfacl");863 mr_asprintf(g_getfacl,"setfacl"); 866 864 log_msg(1, "We will restore ACLs"); 867 865 if (! find_home_of_exe("setfacl")) { … … 871 869 read_cfg_var(cfg_file, "xattr", value); 872 870 if (strstr(value, "TRUE")) { 873 mr_asprintf( &g_getfattr,"setfattr");871 mr_asprintf(g_getfattr,"setfattr"); 874 872 log_msg(1, "We will restore XATTRs"); 875 873 if (! find_home_of_exe("setfattr")) { … … 968 966 * isodir in disaster recovery mode 969 967 */ 970 strcpy(old_isodir, bkpinfo->isodir);968 mr_asprintf(old_isodir, "%s", bkpinfo->isodir); 971 969 read_cfg_var(g_mondo_cfg_file, "iso-mnt", iso_mnt); 972 970 read_cfg_var(g_mondo_cfg_file, "isodir", iso_path); 973 sprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path); 971 mr_free(bkpinfo->isodir); 972 mr_asprintf(tmp1, "%s%s", iso_mnt, iso_path); 973 bkpinfo->isodir = tmp1; 974 974 if (!bkpinfo->isodir[0]) { 975 strcpy(bkpinfo->isodir, old_isodir); 975 mr_free(bkpinfo->isodir); 976 bkpinfo->isodir = old_isodir; 977 } else { 978 mr_free(old_isodir); 976 979 } 977 980 if (!bkpinfo->disaster_recovery) { 978 981 if (strcmp(old_isodir, bkpinfo->isodir)) { 979 log_it 980 ("user nominated isodir differs from archive, keeping user's choice: %s %s\n", 981 old_isodir, bkpinfo->isodir); 982 strcpy(bkpinfo->isodir, old_isodir); 982 log_it("user nominated isodir %s differs from archive, keeping user's choice: %s\n", bkpinfo->isodir, old_isodir ); 983 mr_free(bkpinfo->isodir); 984 bkpinfo->isodir = old_isodir; 985 } else { 986 mr_free(old_isodir); 983 987 } 984 988 } 985 989 read_cfg_var(g_mondo_cfg_file, "iso-dev", g_isodir_device); 986 log_msg(2, "isodir=%s; iso-dev=%s", bkpinfo->isodir, 987 g_isodir_device); 990 log_msg(2, "isodir=%s; iso-dev=%s", bkpinfo->isodir, g_isodir_device); 991 988 992 if (bkpinfo->disaster_recovery) { 989 993 if (is_this_device_mounted(g_isodir_device)) { 990 994 log_msg(2, "NB: isodir is already mounted"); 991 995 /* Find out where it's mounted */ 992 mr_asprintf( &command, "mount | grep -E '^%s' | tail -n1 | cut -d' ' -f3", g_isodir_device);996 mr_asprintf(command, "mount | grep -E '^%s' | tail -n1 | cut -d' ' -f3", g_isodir_device); 993 997 log_it("command = %s", command); 994 998 log_it("res of it = %s", call_program_and_get_last_line_of_output(command)); … … 997 1001 } else { 998 1002 sprintf(iso_mnt, "/tmp/isodir"); 999 mr_asprintf( &tmp1, "mkdir -p %s", iso_mnt);1003 mr_asprintf(tmp1, "mkdir -p %s", iso_mnt); 1000 1004 run_program_and_log_output(tmp1, 5); 1001 1005 mr_free(tmp1); 1002 1006 1003 mr_asprintf( &tmp1, "mount %s %s", g_isodir_device, iso_mnt);1007 mr_asprintf(tmp1, "mount %s %s", g_isodir_device, iso_mnt); 1004 1008 if (run_program_and_log_output(tmp1, 3)) { 1005 1009 log_msg(1, … … 1007 1011 bkpinfo->backup_media_type = cdr; 1008 1012 strcpy(bkpinfo->media_device, "/dev/cdrom"); /* superfluous */ 1009 bkpinfo->isodir[0] =iso_mnt[0] = iso_path[0] = '\0';1013 iso_mnt[0] = iso_path[0] = '\0'; 1010 1014 if (mount_media()) { 1011 1015 mr_free(tmp1); 1012 fatal_error 1013 ("Unable to mount isodir. Failed to mount CD-ROM as well."); 1016 fatal_error("Unable to mount isodir. Failed to mount CD-ROM as well."); 1014 1017 } else { 1015 log_msg(1, 1016 "You backed up to disk, then burned some CDs."); 1018 log_msg(1, "You backed up to disk, then burned some CDs."); 1017 1019 } 1018 1020 } … … 1021 1023 /* bkpinfo->isodir should now be the true path to prefix-1.iso etc... */ 1022 1024 if (bkpinfo->backup_media_type == iso) { 1023 sprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path); 1025 mr_free(bkpinfo->isodir); 1026 mr_asprintf(tmp1, "%s%s", iso_mnt, iso_path); 1027 bkpinfo->isodir = tmp1; 1024 1028 } 1025 1029 } … … 1047 1051 paranoid_free(iso_mnt); 1048 1052 paranoid_free(iso_path); 1049 paranoid_free(old_isodir);1050 1053 return (0); 1051 1054 … … 1105 1108 unlink(FILELIST_FULL_STUB); 1106 1109 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1107 mr_asprintf( &command, "tar -b %ld -zxf %s ./%s ./%s ./%s ./%s ./%s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);1110 mr_asprintf(command, "tar -b %ld -zxf %s ./%s ./%s ./%s ./%s ./%s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB); 1108 1111 log_msg(1, "tarcommand = %s", command); 1109 1112 run_program_and_log_output(command, 1); … … 1113 1116 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 1114 1117 log_msg(2, "pre-2.2.4 compatible mode on"); 1115 mr_asprintf( &command, "tar -b %ld -zxf %s %s %s %s %s %s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);1118 mr_asprintf(command, "tar -b %ld -zxf %s %s %s %s %s %s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB); 1116 1119 log_msg(1, "tarcommand = %s", command); 1117 1120 run_program_and_log_output(command, 1); … … 1119 1122 } 1120 1123 } else { 1121 log_msg(2, 1122 "Calling insist_on_this_cd_number; bkpinfo->isodir=%s", 1123 bkpinfo->isodir); 1124 log_msg(2, "Calling insist_on_this_cd_number; bkpinfo->isodir=%s", bkpinfo->isodir); 1124 1125 insist_on_this_cd_number(1); 1125 1126 log_msg(2, "Back from iotcn"); 1126 1127 run_program_and_log_output("mount", 1); 1127 mr_asprintf( &command, "tar -zxf %s/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);1128 mr_asprintf(command, "tar -zxf %s/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB); 1128 1129 1129 1130 log_msg(1, "tarcommand = %s", command); … … 1134 1135 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 1135 1136 log_msg(2, "pre-2.2.4 compatible mode on"); 1136 mr_asprintf( &command, "tar -zxf %s/images/all.tar.gz %s %s %s %s %s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);1137 mr_asprintf(command, "tar -zxf %s/images/all.tar.gz %s %s %s %s %s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB); 1137 1138 1138 1139 log_msg(1, "tarcommand = %s", command); … … 1149 1150 } 1150 1151 } 1151 mr_asprintf( &command, "cp -f %s %s", MONDO_CFG_FILE_STUB, g_mondo_cfg_file);1152 mr_asprintf(command, "cp -f %s %s", MONDO_CFG_FILE_STUB, g_mondo_cfg_file); 1152 1153 run_program_and_log_output(command, FALSE); 1153 1154 mr_free(command); 1154 1155 1155 mr_asprintf( &command, "cp -f %s/%s %s", bkpinfo->tmpdir, BIGGIELIST_TXT_STUB, g_biggielist_txt);1156 mr_asprintf(command, "cp -f %s/%s %s", bkpinfo->tmpdir, BIGGIELIST_TXT_STUB, g_biggielist_txt); 1156 1157 log_msg(1, "command = %s", command); 1157 1158 paranoid_system(command); 1158 1159 mr_free(command); 1159 1160 1160 mr_asprintf( &command, "ln -sf %s/%s %s", bkpinfo->tmpdir, FILELIST_FULL_STUB, g_filelist_full);1161 mr_asprintf(command, "ln -sf %s/%s %s", bkpinfo->tmpdir, FILELIST_FULL_STUB, g_filelist_full); 1161 1162 log_msg(1, "command = %s", command); 1162 1163 paranoid_system(command); … … 1170 1171 && 1171 1172 ask_me_yes_or_no("Do you want to retrieve the mountlist as well?")) { 1172 mr_asprintf( &command, "ln -sf %s/%s /tmp", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir);1173 mr_asprintf(command, "ln -sf %s/%s /tmp", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir); 1173 1174 paranoid_system(command); 1174 1175 mr_free(command); … … 1195 1196 log_to_screen("Pre-processing filelist"); 1196 1197 if (!does_file_exist(g_biggielist_txt)) { 1197 mr_asprintf( &command, "echo -n > %s", g_biggielist_txt);1198 mr_asprintf(command, "echo -n > %s", g_biggielist_txt); 1198 1199 paranoid_system(command); 1199 1200 mr_free(command); 1200 1201 } 1201 mr_asprintf( &command, "grep -E '^/dev/.*' %s > %s", g_biggielist_txt, g_filelist_imagedevs);1202 mr_asprintf(command, "grep -E '^/dev/.*' %s > %s", g_biggielist_txt, g_filelist_imagedevs); 1202 1203 paranoid_system(command); 1203 1204 mr_free(command); … … 1276 1277 assert_string_is_neither_NULL_nor_zerolength(filename); 1277 1278 1278 mr_asprintf( &tmp, "%s/%s", path_root, filename);1279 mr_asprintf( &command, "cp -f %s %s.pristine", tmp, tmp);1279 mr_asprintf(tmp, "%s/%s", path_root, filename); 1280 mr_asprintf(command, "cp -f %s %s.pristine", tmp, tmp); 1280 1281 mr_free(tmp); 1281 1282 … … 1334 1335 * the current /dev location 1335 1336 */ 1336 mr_asprintf( &cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);1337 mr_asprintf(cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING); 1337 1338 run_program_and_log_output(cmd, 3); 1338 1339 paranoid_free(cmd); … … 1361 1362 #ifdef __FreeBSD__ 1362 1363 else if (!strcmp(name, "BOOT0")) { 1363 mr_asprintf( &tmp, "boot0cfg -B %s", device);1364 mr_asprintf(tmp, "boot0cfg -B %s", device); 1364 1365 res = run_program_and_log_output(tmp, FALSE); 1365 1366 paranoid_free(tmp); 1366 1367 } else { 1367 mr_asprintf( &tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device);1368 mr_asprintf(tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device); 1368 1369 if (!system(tmp)) { 1369 1370 mr_free(tmp); 1370 mr_asprintf( &tmp, MNT_RESTORING "/sbin/fdisk -B %s", device);1371 mr_asprintf(tmp, MNT_RESTORING "/sbin/fdisk -B %s", device); 1371 1372 res = run_program_and_log_output(tmp, 3); 1372 1373 } else { … … 1452 1453 assert_string_is_neither_NULL_nor_zerolength(bd); 1453 1454 strcpy(editor, find_my_editor()); 1454 mr_asprintf( &boot_device, "%s", bd);1455 mr_asprintf(boot_device, "%s", bd); 1455 1456 1456 1457 if (offer_to_run_stabgrub … … 1469 1470 continue; 1470 1471 } 1471 mr_asprintf( &command, "stabgrub-me %s", p);1472 mr_asprintf(command, "stabgrub-me %s", p); 1472 1473 mr_free(p); 1473 1474 … … 1489 1490 newtSuspend(); 1490 1491 } 1491 mr_asprintf( &tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);1492 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1492 1493 paranoid_system(tmp); 1493 1494 mr_free(tmp); 1494 1495 1495 mr_asprintf( &tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor);1496 mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1496 1497 paranoid_system(tmp); 1497 1498 mr_free(tmp); 1498 1499 1499 mr_asprintf( &tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);1500 mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1500 1501 paranoid_system(tmp); 1501 1502 mr_free(tmp); 1502 1503 1503 mr_asprintf( &tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor);1504 mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1504 1505 paranoid_system(tmp); 1505 1506 mr_free(tmp); … … 1513 1514 if (!run_program_and_log_output("which grub-MR", FALSE)) { 1514 1515 log_msg(1, "Yay! grub-MR found..."); 1515 mr_asprintf( &command, "grub-MR %s /tmp/mountlist.txt", boot_device);1516 mr_asprintf(command, "grub-MR %s /tmp/mountlist.txt", boot_device); 1516 1517 log_msg(1, "command = %s", command); 1517 1518 } else { 1518 mr_asprintf( &command, "chroot " MNT_RESTORING " grub-install %s", boot_device);1519 mr_asprintf(command, "chroot " MNT_RESTORING " grub-install %s", boot_device); 1519 1520 log_msg(1, "WARNING - grub-MR not found; using grub-install"); 1520 1521 } … … 1591 1592 0, 1592 1593 "Modifying fstab and elilo.conf... "); 1593 mr_asprintf( &command, "stabelilo-me");1594 mr_asprintf(command, "stabelilo-me"); 1594 1595 res = run_program_and_log_output(command, 3); 1595 1596 mr_free(command); … … 1602 1603 newtSuspend(); 1603 1604 } 1604 mr_asprintf( &tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);1605 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1605 1606 paranoid_system(tmp); 1606 1607 mr_free(tmp); 1607 1608 1608 mr_asprintf( &tmp, "chroot %s %s /etc/elilo.conf", MNT_RESTORING, editor);1609 mr_asprintf(tmp, "chroot %s %s /etc/elilo.conf", MNT_RESTORING, editor); 1609 1610 paranoid_system(tmp); 1610 1611 mr_free(tmp); … … 1667 1668 0, 1668 1669 "Modifying fstab and lilo.conf, and running LILO... "); 1669 mr_asprintf( &command, "stablilo-me");1670 mr_asprintf(command, "stablilo-me"); 1670 1671 res = run_program_and_log_output(command, 3); 1671 1672 mr_free(command); … … 1678 1679 newtSuspend(); 1679 1680 } 1680 mr_asprintf( &tmp, "%s " MNT_RESTORING "/etc/fstab", editor);1681 mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/fstab", editor); 1681 1682 paranoid_system(tmp); 1682 1683 mr_free(tmp); 1683 1684 1684 mr_asprintf( &tmp, "%s " MNT_RESTORING "/etc/lilo.conf", editor);1685 mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/lilo.conf", editor); 1685 1686 paranoid_system(tmp); 1686 1687 mr_free(tmp); … … 1770 1771 1771 1772 strcpy(editor, find_my_editor()); 1772 mr_asprintf( &boot_device, "%s", bd);1773 mr_asprintf(boot_device, "%s", bd); 1773 1774 1774 1775 if (offer_to_hack_scripts … … 1783 1784 newtSuspend(); 1784 1785 } 1785 mr_asprintf( &tmp, "%s " MNT_RESTORING "/etc/fstab", editor);1786 mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/fstab", editor); 1786 1787 paranoid_system(tmp); 1787 1788 mr_free(tmp); … … 1798 1799 continue; 1799 1800 } 1800 mr_asprintf( &command, "stabraw-me %s", p);1801 mr_asprintf(command, "stabraw-me %s", p); 1801 1802 mr_free(p); 1802 1803 … … 1812 1813 } else { 1813 1814 /* nuke mode */ 1814 mr_asprintf( &command, "raw-MR %s /tmp/mountlist.txt", boot_device);1815 mr_asprintf(command, "raw-MR %s /tmp/mountlist.txt", boot_device); 1815 1816 log_msg(2, "run_raw_mbr() --- command='%s'", command); 1816 1817 … … 1939 1940 for (i = 0; i < 20; i++) { 1940 1941 g_current_progress = i; 1941 mr_asprintf( &tmp, "You have %d seconds left to abort.", 20 - i);1942 mr_asprintf(tmp, "You have %d seconds left to abort.", 20 - i); 1942 1943 update_progress_form(tmp); 1943 1944 mr_free(tmp); … … 1991 1992 paranoid_system("sync"); 1992 1993 1993 mr_asprintf( &tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);1994 mr_asprintf(tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE); 1994 1995 if (run_program_and_log_output(tmp, FALSE)) { 1995 1996 log_msg(1, … … 2010 2011 continue; 2011 2012 } 2012 mr_asprintf( &tmp, "Unmounting device %s ", mountlist->el[lino].device);2013 mr_asprintf(tmp, "Unmounting device %s ", mountlist->el[lino].device); 2013 2014 2014 2015 update_progress_form(tmp); … … 2016 2017 if (is_this_device_mounted(mountlist->el[lino].device)) { 2017 2018 if (!strcmp(mountlist->el[lino].mountpoint, "swap")) { 2018 mr_asprintf( &command, "swapoff %s", mountlist->el[lino].device);2019 mr_asprintf(command, "swapoff %s", mountlist->el[lino].device); 2019 2020 } else { 2020 2021 if (!strcmp(mountlist->el[lino].mountpoint, "/1")) { 2021 mr_asprintf( &command, "umount %s/", MNT_RESTORING);2022 mr_asprintf(command, "umount %s/", MNT_RESTORING); 2022 2023 log_msg(3, 2023 2024 "Well, I know a certain kitty-kitty who'll be sleeping with Mommy tonight..."); 2024 2025 } else { 2025 mr_asprintf( &command, "umount " MNT_RESTORING "%s", mountlist->el[lino].mountpoint);2026 mr_asprintf(command, "umount " MNT_RESTORING "%s", mountlist->el[lino].mountpoint); 2026 2027 2027 2028 /* To support latest Ubuntu where /var is a separate FS … … 2090 2091 } 2091 2092 2092 mr_asprintf( &command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx ./%s ./%s ./%s ./%s ./%s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);2093 mr_asprintf(command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx ./%s ./%s ./%s ./%s ./%s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); 2093 2094 log_msg(2, "command = '%s'", command); 2094 2095 res = run_program_and_log_output(command, -1); … … 2101 2102 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 2102 2103 log_msg(2, "pre-2.2.4 compatible mode on"); 2103 mr_asprintf( &command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);2104 mr_asprintf(command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); 2104 2105 log_msg(2, "command = '%s'", command); 2105 2106 res = run_program_and_log_output(command, -1); … … 2148 2149 log_msg(2, "gcffa --- starting"); 2149 2150 log_to_screen("I'm thinking..."); 2150 mr_asprintf( &mountpt, "%s/mount.bootdisk", bkpinfo->tmpdir);2151 mr_asprintf(mountpt, "%s/mount.bootdisk", bkpinfo->tmpdir); 2151 2152 device[0] = '\0'; 2152 2153 chdir(bkpinfo->tmpdir); 2153 mr_asprintf( &cfg_file, "%s", MONDO_CFG_FILE_STUB);2154 mr_asprintf(cfg_file, "%s", MONDO_CFG_FILE_STUB); 2154 2155 unlink(cfg_file); // cfg_file[] is missing the '/' at the start, FYI, by intent 2155 2156 mr_free(cfg_file); … … 2157 2158 unlink(FILELIST_FULL_STUB); 2158 2159 unlink(BIGGIELIST_TXT_STUB); 2159 mr_asprintf( &command, "mkdir -p %s", mountpt);2160 mr_asprintf(command, "mkdir -p %s", mountpt); 2160 2161 run_program_and_log_output(command, FALSE); 2161 2162 mr_free(command); 2162 2163 2163 mr_asprintf( &cfg_file, "%s/%s", bkpinfo->tmpdir, MONDO_CFG_FILE_STUB);2164 mr_asprintf( &mountlist_file, "%s/%s", bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB);2164 mr_asprintf(cfg_file, "%s/%s", bkpinfo->tmpdir, MONDO_CFG_FILE_STUB); 2165 mr_asprintf(mountlist_file, "%s/%s", bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB); 2165 2166 log_msg(2, "mountpt = %s; cfg_file=%s", mountpt, cfg_file); 2166 2167 mr_free(mountpt); … … 2192 2193 log_msg(2, "media_device is blank; assuming %s"); 2193 2194 } 2194 mr_asprintf( &tmp, "%s", bkpinfo->media_device);2195 mr_asprintf(tmp, "%s", bkpinfo->media_device); 2195 2196 if (extract_cfg_file_and_mountlist_from_tape_dev 2196 2197 (bkpinfo->media_device)) { … … 2231 2232 log_msg(2, 2232 2233 "gcffa --- Plan B, a.k.a. untarring some file from all.tar.gz"); 2233 mr_asprintf( &command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary2234 mr_asprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary 2234 2235 run_program_and_log_output(command, TRUE); 2235 2236 mr_free(command); … … 2238 2239 /* Doing that allow us to remain compatible with pre-2.2.5 versions */ 2239 2240 log_msg(2, "pre-2.2.4 compatible mode on"); 2240 mr_asprintf( &command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz %s %s %s %s %s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary2241 mr_asprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz %s %s %s %s %s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary 2241 2242 run_program_and_log_output(command, TRUE); 2242 2243 mr_free(command); … … 2251 2252 if (does_file_exist(MONDO_CFG_FILE_STUB)) { 2252 2253 log_msg(1, "gcffa --- great! We've got the config file"); 2253 mr_asprintf( &tmp, "%s/%s", call_program_and_get_last_line_of_output("pwd"), MONDO_CFG_FILE_STUB);2254 mr_asprintf( &command, "cp -f %s %s", tmp, cfg_file);2254 mr_asprintf(tmp, "%s/%s", call_program_and_get_last_line_of_output("pwd"), MONDO_CFG_FILE_STUB); 2255 mr_asprintf(command, "cp -f %s %s", tmp, cfg_file); 2255 2256 log_it("%s",command); 2256 2257 if (strcmp(tmp, cfg_file) && run_program_and_log_output(command, 1)) { … … 2261 2262 mr_free(command); 2262 2263 2263 mr_asprintf( &command, "cp -f %s/%s %s", call_program_and_get_last_line_of_output("pwd"),2264 mr_asprintf(command, "cp -f %s/%s %s", call_program_and_get_last_line_of_output("pwd"), 2264 2265 MOUNTLIST_FNAME_STUB, mountlist_file); 2265 2266 log_it("%s",command); … … 2271 2272 2272 2273 mr_free(command); 2273 mr_asprintf( &command, "cp -f %s %s", mountlist_file, g_mountlist_fname);2274 mr_asprintf(command, "cp -f %s %s", mountlist_file, g_mountlist_fname); 2274 2275 if (run_program_and_log_output(command, 1)) { 2275 2276 log_msg(1, "Failed to copy mountlist to /tmp"); … … 2277 2278 log_msg(1, "Copied mountlist to /tmp as well OK"); 2278 2279 mr_free(command); 2279 mr_asprintf( &command, "cp -f %s /tmp/",IWANTMYLVM_STUB);2280 mr_asprintf(command, "cp -f %s /tmp/",IWANTMYLVM_STUB); 2280 2281 run_program_and_log_output(command, 1); 2281 2282 } … … 2301 2302 /* Is this code really useful ??? */ 2302 2303 if (extract_mountlist_stub) { 2303 mr_asprintf( &command, "cp -f %s %s/%s", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB);2304 mr_asprintf(command, "cp -f %s %s/%s", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB); 2304 2305 run_program_and_log_output(command, FALSE); 2305 2306 mr_free(command); … … 2307 2308 } 2308 2309 2309 mr_asprintf( &command, "cp -f %s /%s", cfg_file, MONDO_CFG_FILE_STUB);2310 mr_asprintf(command, "cp -f %s /%s", cfg_file, MONDO_CFG_FILE_STUB); 2310 2311 mr_free(cfg_file); 2311 2312 … … 2314 2315 2315 2316 if (extract_mountlist_stub) { 2316 mr_asprintf( &command, "cp -f %s /%s", mountlist_file, MOUNTLIST_FNAME_STUB);2317 mr_asprintf(command, "cp -f %s /%s", mountlist_file, MOUNTLIST_FNAME_STUB); 2317 2318 run_program_and_log_output(command, FALSE); 2318 2319 mr_free(command); … … 2320 2321 mr_free(mountlist_file); 2321 2322 2322 mr_asprintf( &command, "cp -f etc/raidtab /etc/");2323 mr_asprintf(command, "cp -f etc/raidtab /etc/"); 2323 2324 run_program_and_log_output(command, FALSE); 2324 2325 mr_free(command); 2325 2326 2326 2327 if (extract_i_want_my_lvm) { 2327 mr_asprintf( &command, "cp -f %s /tmp/",IWANTMYLVM_STUB);2328 mr_asprintf(command, "cp -f %s /tmp/",IWANTMYLVM_STUB); 2328 2329 run_program_and_log_output(command, FALSE); 2329 2330 mr_free(command); … … 2382 2383 } 2383 2384 log_msg(1,"Sync'ing %s (i=%d)", raidlist->el[i].raid_device, i); 2384 mr_asprintf( &screen_message, "Sync'ing %s", raidlist->el[i].raid_device);2385 mr_asprintf(screen_message, "Sync'ing %s", raidlist->el[i].raid_device); 2385 2386 open_evalcall_form(screen_message); 2386 2387 mr_free(screen_message); -
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2321 r2323 280 280 } 281 281 if (g_ISO_restore_mode) { 282 mr_asprintf( &tmp, "umount %s", bkpinfo->isodir);282 mr_asprintf(tmp, "umount %s", bkpinfo->isodir); 283 283 run_program_and_log_output(tmp, FALSE); 284 284 mr_free(tmp); … … 361 361 362 362 /* Clean up blkid cache file if they exist */ 363 mr_asprintf( &tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path);363 mr_asprintf(tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path); 364 364 (void)unlink(tmp1); 365 365 paranoid_free(tmp1); 366 mr_asprintf( &tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);366 mr_asprintf(tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path); 367 367 (void)unlink(tmp1); 368 368 paranoid_free(tmp1); … … 376 376 377 377 /* Clean up multiconf cache file if they exist */ 378 mr_asprintf( &tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);378 mr_asprintf(tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path); 379 379 (void)unlink(tmp1); 380 380 paranoid_free(tmp1); 381 381 382 382 /* Edit multipath.conf if needed to adapt wwid */ 383 mr_asprintf( &tmp1,"%s/etc/multipath.conf", MNT_RESTORING);383 mr_asprintf(tmp1,"%s/etc/multipath.conf", MNT_RESTORING); 384 384 if (does_file_exist(tmp1)) { 385 385 log_msg(2, "We may need to clean /etc/multipath.conf"); … … 391 391 392 392 if (bkpinfo->restore_mode != nuke) { 393 mr_asprintf( &editor, "%s", find_my_editor());394 mr_asprintf( &tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);393 mr_asprintf(editor, "%s", find_my_editor()); 394 mr_asprintf(tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor); 395 395 popup_and_OK("You will now edit multipath.conf"); 396 396 if (!g_text_mode) { … … 490 490 if (g_text_mode) { 491 491 save_mountlist_to_disk(mountlist, g_mountlist_fname); 492 mr_asprintf( &tmp1, "%s %s", find_my_editor(), g_mountlist_fname);492 mr_asprintf(tmp1, "%s %s", find_my_editor(), g_mountlist_fname); 493 493 res = system(tmp1); 494 494 mr_free(tmp1); … … 663 663 strcpy(fstab_fname, "/tmp/fstab"); 664 664 } 665 mr_asprintf( &tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE);665 mr_asprintf(tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE); 666 666 res = system(tmp1); 667 667 mr_free(tmp1); … … 780 780 assert(raidlist != NULL); 781 781 782 mr_asprintf( &tmpA, "%s", " ");783 mr_asprintf( &tmpB, "%s", " ");784 mr_asprintf( &tmpC, "%s", " ");782 mr_asprintf(tmpA, "%s", " "); 783 mr_asprintf(tmpB, "%s", " "); 784 mr_asprintf(tmpC, "%s", " "); 785 785 786 786 log_msg(2, "nuke_mode --- starting"); … … 803 803 } 804 804 if (!evaluate_mountlist(mountlist, tmpA, tmpB, tmpC)) { 805 mr_asprintf( &tmp, "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", tmpA, tmpB, tmpC);805 mr_asprintf(tmp, "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", tmpA, tmpB, tmpC); 806 806 res = ask_me_yes_or_no(tmp); 807 807 mr_free(tmp); … … 895 895 "Using tune2fs to identify your ext2,3 partitions"); 896 896 897 mr_asprintf( &tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname);897 mr_asprintf(tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname); 898 898 res = run_program_and_log_output(tmp, TRUE); 899 899 mr_free(tmp); … … 915 915 ("Please visit our website at http://www.mondorescue.org for more information."); 916 916 } else { 917 mr_asprintf( &tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information.");917 mr_asprintf(tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information."); 918 918 popup_and_OK(tmp); 919 919 mr_free(tmp); … … 1121 1121 if (!strncmp(biggiestruct.filename, "/dev/", 5)) // Whether NTFS or not :) 1122 1122 { 1123 mr_asprintf( &outfile_fname, "%s", biggiestruct.filename);1123 mr_asprintf(outfile_fname, "%s", biggiestruct.filename); 1124 1124 } else { 1125 mr_asprintf( &outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);1125 mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename); 1126 1126 } 1127 1127 … … 1159 1159 use_ntfsprog_hack = TRUE; 1160 1160 log_msg(2, "Calling ntfsclone in background because %s is an NTFS /dev entry", outfile_fname); 1161 mr_asprintf( &sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768),1161 mr_asprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768), 1162 1162 (int) (random() % 32768)); 1163 1163 mkfifo(sz_devfile, 0x770); … … 1232 1232 mr_free(mds); 1233 1233 1234 mr_asprintf( &tmp, "Restoring from %s #%d", mds, g_current_media_number);1234 mr_asprintf(tmp, "Restoring from %s #%d", mds, g_current_media_number); 1235 1235 log_to_screen(tmp); 1236 1236 mr_free(tmp); … … 1239 1239 log_to_screen("Continuing to restore."); 1240 1240 } else { 1241 mr_asprintf( &tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, ""));1241 mr_asprintf(tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "")); 1242 1242 if (does_file_exist(tmp) && length_of_file(tmp) == 0) { 1243 1243 log_msg(2, … … 1251 1251 (slice_fname 1252 1252 (bigfileno, sliceno, ARCHIVES_PATH, "lzo"))) { 1253 mr_asprintf( &bzip2_command, "lzop");1253 mr_asprintf(bzip2_command, "lzop"); 1254 1254 strcpy(suffix, "lzo"); 1255 1255 } else … … 1257 1257 (slice_fname 1258 1258 (bigfileno, sliceno, ARCHIVES_PATH, "gz"))) { 1259 mr_asprintf( &bzip2_command, "gzip");1259 mr_asprintf(bzip2_command, "gzip"); 1260 1260 strcpy(suffix, "gz"); 1261 1261 } else … … 1263 1263 (slice_fname 1264 1264 (bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) { 1265 mr_asprintf( &bzip2_command, "bzip2");1265 mr_asprintf(bzip2_command, "bzip2"); 1266 1266 strcpy(suffix, "bz2"); 1267 1267 } else … … 1269 1269 (slice_fname 1270 1270 (bigfileno, sliceno, ARCHIVES_PATH, ""))) { 1271 mr_asprintf( &bzip2_command, "");1271 mr_asprintf(bzip2_command, ""); 1272 1272 strcpy(suffix, ""); 1273 1273 } else { … … 1282 1282 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1283 1283 } else { 1284 mr_asprintf( &bzip2_command, "cat %s 2>> %s",1284 mr_asprintf(bzip2_command, "cat %s 2>> %s", 1285 1285 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1286 1286 } 1287 1287 mds = media_descriptor_string(bkpinfo->backup_media_type); 1288 mr_asprintf( &tmp, "Working on %s #%d, file #%ld, slice #%ld ", mds, g_current_media_number, bigfileno + 1, sliceno);1288 mr_asprintf(tmp, "Working on %s #%d, file #%ld, slice #%ld ", mds, g_current_media_number, bigfileno + 1, sliceno); 1289 1289 mr_free(mds); 1290 1290 log_msg(2, tmp); … … 1321 1321 if (use_ntfsprog_hack) { 1322 1322 log_msg(3, "Waiting for ntfsclone to finish"); 1323 mr_asprintf( &tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");1323 mr_asprintf(tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1324 1324 while (system(tmp) == 0) { 1325 1325 sleep(1); … … 1452 1452 if (use_ntfsprog) { 1453 1453 g_loglevel = 4; 1454 mr_asprintf( &outfile_fname, "%s", orig_bf_fname);1454 mr_asprintf(outfile_fname, "%s", orig_bf_fname); 1455 1455 use_ntfsprog_hack = TRUE; 1456 1456 log_msg(2, "Calling ntfsclone in background because %s is a /dev entry", outfile_fname); 1457 mr_asprintf( &sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));1457 mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768)); 1458 1458 mkfifo(sz_devfile, 0x770); 1459 1459 strcpy(ntfsprog_fifo, sz_devfile); … … 1475 1475 if (!strncmp(orig_bf_fname, "/dev/", 5)) { 1476 1476 // non-NTFS partition 1477 mr_asprintf( &outfile_fname, "%s", orig_bf_fname);1477 mr_asprintf(outfile_fname, "%s", orig_bf_fname); 1478 1478 } else { 1479 1479 // biggiefile 1480 mr_asprintf( &outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname);1480 mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname); 1481 1481 } 1482 1482 use_ntfsprog_hack = FALSE; … … 1492 1492 if (dummy_restore) { 1493 1493 mr_free(outfile_fname); 1494 mr_asprintf( &outfile_fname, "/dev/null");1494 mr_asprintf(outfile_fname, "/dev/null"); 1495 1495 } 1496 1496 1497 1497 if (!bkpinfo->zip_exe[0]) { 1498 mr_asprintf( &command, "cat > \"%s\"", file_to_openout);1498 mr_asprintf(command, "cat > \"%s\"", file_to_openout); 1499 1499 } else { 1500 mr_asprintf( &command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE);1500 mr_asprintf(command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE); 1501 1501 if (strcmp(bkpinfo->zip_exe, "gzip") == 0) { 1502 1502 /* Ignore SIGPIPE for gzip as it causes errors on big files … … 1568 1568 if (use_ntfsprog_hack) { 1569 1569 log_msg(3, "Waiting for ntfsclone to finish"); 1570 mr_asprintf( &tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");1570 mr_asprintf(tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1571 1571 while (system(tmp1) == 0) { 1572 1572 sleep(1); … … 1637 1637 log_msg(5, "Entering"); 1638 1638 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 1639 mr_asprintf( &command, "mkdir -p %s/tmp", MNT_RESTORING);1639 mr_asprintf(command, "mkdir -p %s/tmp", MNT_RESTORING); 1640 1640 run_program_and_log_output(command, 9); 1641 1641 paranoid_free(command); 1642 1642 1643 mr_asprintf( &filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number);1643 mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number); 1644 1644 if (length_of_file(filelist_name) <= 2) { 1645 1645 log_msg(2, "There are _zero_ files in filelist '%s'", filelist_name); … … 1654 1654 log_msg(3, "length_of_file(%s) = %llu", tarball_fname, length_of_file(tarball_fname)); 1655 1655 log_msg(3, "count_lines_in_file(%s) = %llu", tarball_fname, count_lines_in_file(tarball_fname)); 1656 mr_asprintf( &tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number);1656 mr_asprintf(tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number); 1657 1657 log_to_screen(tmp); 1658 1658 mr_free(tmp); … … 1663 1663 1664 1664 if (filelist) { 1665 mr_asprintf( &filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number);1665 mr_asprintf(filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number); 1666 1666 if ((matches = 1667 1667 save_filelist_entries_in_common(filelist_name, filelist, … … 1672 1672 log_msg(3, "Saved fileset %ld's subset to %s", current_tarball_number, filelist_subset_fname); 1673 1673 } 1674 mr_asprintf( &screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches);1674 mr_asprintf(screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches); 1675 1675 log_to_screen(screen_message); 1676 1676 mr_free(screen_message); … … 1680 1680 if (filelist == NULL || matches > 0) { 1681 1681 if (g_getfattr) { 1682 mr_asprintf( &xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);1682 mr_asprintf(xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number); 1683 1683 } 1684 1684 if (g_getfacl) { 1685 mr_asprintf( &acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);1685 mr_asprintf(acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number); 1686 1686 } 1687 1687 if (strstr(tarball_fname, ".bz2")) { 1688 mr_asprintf( &executable, "bzip2");1688 mr_asprintf(executable, "bzip2"); 1689 1689 } else if (strstr(tarball_fname, ".gz")) { 1690 mr_asprintf( &executable, "gzip");1690 mr_asprintf(executable, "gzip"); 1691 1691 } else if (strstr(tarball_fname, ".lzo")) { 1692 mr_asprintf( &executable, "lzop");1692 mr_asprintf(executable, "lzop"); 1693 1693 } 1694 1694 if (executable) { 1695 mr_asprintf( &tmp, "which %s > /dev/null 2> /dev/null", executable);1695 mr_asprintf(tmp, "which %s > /dev/null 2> /dev/null", executable); 1696 1696 res = run_program_and_log_output(tmp, FALSE); 1697 1697 mr_free(tmp); … … 1702 1702 } 1703 1703 tmp = executable; 1704 mr_asprintf( &executable, "-P %s -Z", tmp);1704 mr_asprintf(executable, "-P %s -Z", tmp); 1705 1705 mr_free(tmp); 1706 1706 } … … 1712 1712 1713 1713 if (use_star) { 1714 mr_asprintf( &command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname);1714 mr_asprintf(command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname); 1715 1715 if (strstr(tarball_fname, ".bz2")) { 1716 1716 mr_strcat(command, " -bz"); … … 1721 1721 } else { 1722 1722 if (filelist_subset_fname != NULL) { 1723 mr_asprintf( &command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname);1723 mr_asprintf(command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname); 1724 1724 } else { 1725 mr_asprintf( &command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);1725 mr_asprintf(command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname); 1726 1726 } 1727 1727 } … … 1730 1730 1731 1731 #undef BUFSIZE 1732 mr_asprintf( &temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768));1732 mr_asprintf(temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768)); 1733 1733 1734 1734 mr_strcat(command, " 2>> %s >> %s", temp_log, temp_log); … … 1776 1776 } 1777 1777 if (retval) { 1778 mr_asprintf( &command, "cat %s >> %s", temp_log, MONDO_LOGFILE);1778 mr_asprintf(command, "cat %s >> %s", temp_log, MONDO_LOGFILE); 1779 1779 system(command); 1780 1780 paranoid_free(command); … … 1865 1865 * in afio or someting; oh darn.. OK, use tmpfs :-) * 1866 1866 ****************************************************************************/ 1867 mr_asprintf( &afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number);1868 mr_asprintf( &filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number);1869 mr_asprintf( &filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number);1867 mr_asprintf(afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number); 1868 mr_asprintf(filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number); 1869 mr_asprintf(filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number); 1870 1870 1871 1871 res = read_file_from_stream_to_file(afio_fname, size); … … 1877 1877 } 1878 1878 if (bkpinfo->compression_level == 0) { 1879 mr_asprintf( &executable, "%s", "");1879 mr_asprintf(executable, "%s", ""); 1880 1880 } else { 1881 1881 if (bkpinfo->use_star) { 1882 mr_asprintf( &executable, "%s", " -bz");1882 mr_asprintf(executable, "%s", " -bz"); 1883 1883 } else { 1884 mr_asprintf( &executable, "-P %s -Z", bkpinfo->zip_exe);1884 mr_asprintf(executable, "-P %s -Z", bkpinfo->zip_exe); 1885 1885 } 1886 1886 } … … 1893 1893 if (strstr(tarball_fname, ".star.")) { 1894 1894 use_star = TRUE; 1895 mr_asprintf( &command, "star -t file=%s %s", afio_fname, executable);1895 mr_asprintf(command, "star -t file=%s %s", afio_fname, executable); 1896 1896 } else { 1897 1897 use_star = FALSE; 1898 mr_asprintf( &command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname);1898 mr_asprintf(command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname); 1899 1899 } 1900 1900 mr_strcat(command, " > %s 2>> %s", filelist_fname, MONDO_LOGFILE); … … 1927 1927 if (strstr(tarball_fname, ".star.")) { 1928 1928 // star 1929 mr_asprintf( &command, "star -x file=%s %s", afio_fname, executable);1929 mr_asprintf(command, "star -x file=%s %s", afio_fname, executable); 1930 1930 if (filelist) { 1931 1931 mr_strcat(command, " list=%s", filelist_subset_fname); … … 1933 1933 } else { 1934 1934 // afio 1935 mr_asprintf( &command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable);1935 mr_asprintf(command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable); 1936 1936 if (filelist) { 1937 1937 mr_strcat(command, " -w %s", filelist_subset_fname); … … 2026 2026 assert(bkpinfo != NULL); 2027 2027 2028 mr_asprintf( &biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);2028 mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2029 2029 if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) { 2030 2030 log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set); … … 2033 2033 read_cfg_var(g_mondo_cfg_file, "total-slices", tmp); 2034 2034 total_slices = atol(tmp); 2035 mr_asprintf( &tmp1, "Reassembling large files ");2035 mr_asprintf(tmp1, "Reassembling large files "); 2036 2036 mvaddstr_and_log_it(g_currentY, 0, tmp1); 2037 2037 mr_free(tmp1); … … 2066 2066 } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 2067 2067 insist_on_this_cd_number(++g_current_media_number); 2068 mr_asprintf( &tmp1, "Restoring from %s #%d", mds, g_current_media_number);2068 mr_asprintf(tmp1, "Restoring from %s #%d", mds, g_current_media_number); 2069 2069 log_to_screen(tmp1); 2070 2070 mr_free(tmp1); … … 2081 2081 } else { 2082 2082 just_changed_cds = FALSE; 2083 mr_asprintf( &tmp1, "Restoring big file %ld", bigfileno + 1);2083 mr_asprintf(tmp1, "Restoring big file %ld", bigfileno + 1); 2084 2084 update_progress_form(tmp1); 2085 2085 mr_free(tmp1); … … 2098 2098 fclose(fbw); 2099 2099 if (g_getfattr) { 2100 mr_asprintf( &xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);2100 mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2101 2101 if (length_of_file(xattr_fname) > 0) { 2102 2102 set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname); … … 2105 2105 } 2106 2106 if (g_getfacl) { 2107 mr_asprintf( &acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);2107 mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2108 2108 if (length_of_file(acl_fname) > 0) { 2109 2109 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); … … 2177 2177 2178 2178 mds = media_descriptor_string(bkpinfo->backup_media_type); 2179 mr_asprintf( &progress_str, "Restoring from %s #%d", mds, g_current_media_number);2179 mr_asprintf(progress_str, "Restoring from %s #%d", mds, g_current_media_number); 2180 2180 2181 2181 log_to_screen(progress_str); … … 2189 2189 mr_free(progress_str); 2190 2190 2191 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number);2191 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number); 2192 2192 if (!does_file_exist(tarball_fname)) { 2193 2193 mr_free(tarball_fname); 2194 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number);2194 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number); 2195 2195 } 2196 2196 if (!does_file_exist(tarball_fname)) { 2197 2197 mr_free(tarball_fname); 2198 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number);2198 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number); 2199 2199 } 2200 2200 if (!does_file_exist(tarball_fname)) { 2201 2201 mr_free(tarball_fname); 2202 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number);2202 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number); 2203 2203 } 2204 2204 if (!does_file_exist(tarball_fname)) { 2205 2205 mr_free(tarball_fname); 2206 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number);2206 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number); 2207 2207 } 2208 2208 if (!does_file_exist(tarball_fname)) { 2209 2209 mr_free(tarball_fname); 2210 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number);2210 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number); 2211 2211 } 2212 2212 if (!does_file_exist(tarball_fname)) { … … 2224 2224 } 2225 2225 g_current_media_number++; 2226 mr_asprintf( &progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number);2226 mr_asprintf(progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number); 2227 2227 log_to_screen(progress_str); 2228 2228 } else { 2229 mr_asprintf( &progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number);2229 mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number); 2230 2230 for (res = 999, attempts = 0; attempts < 3 && res != 0; 2231 2231 attempts++) { … … 2235 2235 filelist); 2236 2236 } 2237 mr_asprintf( &tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number);2237 mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number); 2238 2238 if (res) { 2239 2239 mr_strcat(tmp1, "reported errors"); … … 2319 2319 total_slices = atol(tmp); 2320 2320 if (g_getfattr) { 2321 mr_asprintf( &xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2321 mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2322 2322 } 2323 2323 if (g_getfacl) { 2324 mr_asprintf( &acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2325 } 2326 mr_asprintf( &tmp1, "Reassembling large files ");2324 mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2325 } 2326 mr_asprintf(tmp1, "Reassembling large files "); 2327 2327 mvaddstr_and_log_it(g_currentY, 0, tmp1); 2328 2328 mr_free(tmp1); 2329 2329 2330 mr_asprintf( &biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);2330 mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2331 2331 if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) { 2332 2332 log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set); … … 2364 2364 p++; 2365 2365 } 2366 mr_asprintf( &tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024);2366 mr_asprintf(tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024); 2367 2367 update_progress_form(tmp1); 2368 2368 mr_free(tmp1); … … 2479 2479 run_program_and_log_output("pwd", 5); 2480 2480 2481 mr_asprintf( &progress_str, "Restoring from media #%d", g_current_media_number);2481 mr_asprintf(progress_str, "Restoring from media #%d", g_current_media_number); 2482 2482 log_to_screen(progress_str); 2483 2483 open_progress_form("Restoring from archives", … … 2501 2501 update_progress_form(progress_str); 2502 2502 if (g_getfattr) { 2503 mr_asprintf( &xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);2503 mr_asprintf(xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number); 2504 2504 unlink(xattr_fname); 2505 2505 } 2506 2506 if (g_getfacl) { 2507 mr_asprintf( &acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);2507 mr_asprintf(acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number); 2508 2508 unlink(acl_fname); 2509 2509 } … … 2519 2519 retval += res; 2520 2520 if (res) { 2521 mr_asprintf( &tmp, "Fileset %ld - errors occurred", current_afioball_number);2521 mr_asprintf(tmp, "Fileset %ld - errors occurred", current_afioball_number); 2522 2522 log_to_screen(tmp); 2523 2523 mr_free(tmp); … … 2534 2534 2535 2535 mr_free(progress_str); 2536 mr_asprintf( &progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number);2536 mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number); 2537 2537 mr_free(mds); 2538 2538 res = read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr); … … 2594 2594 g_current_media_number = 1; 2595 2595 getcwd(cwd, MAX_STR_LEN - 1); 2596 mr_asprintf( &tmp, "mkdir -p %s", bkpinfo->restore_path);2596 mr_asprintf(tmp, "mkdir -p %s", bkpinfo->restore_path); 2597 2597 run_program_and_log_output(tmp, FALSE); 2598 2598 mr_free(tmp); … … 2666 2666 { 2667 2667 log_msg(0, "-------------- Mondo Restore v%s -------------", PACKAGE_VERSION); 2668 log_msg(0, 2669 "DON'T PANIC! Mondorestore logs almost everything, so please "); 2670 log_msg(0, 2671 "don't break out in a cold sweat just because you see a few "); 2672 log_msg(0, 2673 "error messages in the log. Read them; analyze them; see if "); 2674 log_msg(0, 2675 "they are significant; above all, verify your backups! Please"); 2676 log_msg(0, 2677 "attach a compressed copy of this log to any e-mail you send "); 2678 log_msg(0, 2679 "to the Mondo mailing list when you are seeking technical "); 2680 log_msg(0, 2681 "support. Without it, we can't help you. - DevTeam"); 2682 log_msg(0, 2683 "------------------------------------------------------------"); 2684 log_msg(0, 2685 "BTW, despite (or perhaps because of) the wealth of messages,"); 2686 log_msg(0, 2687 "some users are inclined to stop reading this log. If Mondo "); 2688 log_msg(0, 2689 "stopped for some reason, chances are it's detailed here. "); 2690 log_msg(0, 2691 "More than likely there's a message at the very end of this "); 2692 log_msg(0, 2693 "log that will tell you what is wrong. Please read it! "); 2694 log_msg(0, 2695 "------------------------------------------------------------"); 2668 log_msg(0, "DON'T PANIC! Mondorestore logs almost everything, so please "); 2669 log_msg(0, "don't break out in a cold sweat just because you see a few "); 2670 log_msg(0, "error messages in the log. Read them; analyze them; see if "); 2671 log_msg(0, "they are significant; above all, verify your backups! Please"); 2672 log_msg(0, "attach a compressed copy of this log to any e-mail you send "); 2673 log_msg(0, "to the Mondo mailing list when you are seeking technical "); 2674 log_msg(0, "support. Without it, we can't help you. - DevTeam"); 2675 log_msg(0, "------------------------------------------------------------"); 2676 log_msg(0, "BTW, despite (or perhaps because of) the wealth of messages,"); 2677 log_msg(0, "some users are inclined to stop reading this log. If Mondo "); 2678 log_msg(0, "stopped for some reason, chances are it's detailed here. "); 2679 log_msg(0, "More than likely there's a message at the very end of this "); 2680 log_msg(0, "log that will tell you what is wrong. Please read it! "); 2681 log_msg(0, "------------------------------------------------------------"); 2696 2682 } 2697 2683 … … 2768 2754 2769 2755 /* Backup original mountlist.txt */ 2770 mr_asprintf( &tmp, "%s.orig", g_mountlist_fname);2756 mr_asprintf(tmp, "%s.orig", g_mountlist_fname); 2771 2757 if (!does_file_exist(g_mountlist_fname)) { 2772 2758 log_msg(2, "%ld: Warning - g_mountlist_fname (%s) does not exist yet", __LINE__, g_mountlist_fname); 2773 2759 } else if (!does_file_exist(tmp)) { 2774 2760 mr_free(tmp); 2775 mr_asprintf( &tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname);2761 mr_asprintf(tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname); 2776 2762 run_program_and_log_output(tmp, FALSE); 2777 2763 } … … 2948 2934 log_msg(2, "Still here. Yay."); 2949 2935 if ((strlen(bkpinfo->tmpdir) > 0) && (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL)) { 2950 mr_asprintf( &tmp, "rm -Rf %s/*", bkpinfo->tmpdir);2936 mr_asprintf(tmp, "rm -Rf %s/*", bkpinfo->tmpdir); 2951 2937 run_program_and_log_output(tmp, FALSE); 2952 2938 mr_free(tmp); … … 2971 2957 && !is_this_device_mounted(bkpinfo->nfs_mount)) { 2972 2958 log_msg(1, "Mounting nfs dir"); 2973 sprintf(bkpinfo->isodir, "/tmp/isodir"); 2959 mr_free(bkpinfo->isodir); 2960 mr_asprintf(tmp, "/tmp/isodir"); 2961 bkpinfo->isodir = tmp; 2974 2962 run_program_and_log_output("mkdir -p /tmp/isodir", 5); 2975 mr_asprintf( &tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount);2963 mr_asprintf(tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount); 2976 2964 run_program_and_log_output(tmp, 1); 2977 2965 mr_free(tmp); … … 3070 3058 } else { 3071 3059 log_msg(1, "Re-mounted partitions for post-nuke stuff"); 3072 mr_asprintf( &tmp, "post-nuke %s %d", bkpinfo->restore_path, retval);3060 mr_asprintf(tmp, "post-nuke %s %d", bkpinfo->restore_path, retval); 3073 3061 log_msg(2, "Calling '%s'", tmp); 3074 3062 if ((res = run_program_and_log_output(tmp, 0))) { … … 3091 3079 set_signals(FALSE); 3092 3080 log_to_screen("Restore log (%s) copied to /var/log on your hard disk", MONDO_LOGFILE); 3093 mr_asprintf( &tmp, "Mondo-restore is exiting (retval=%d) ", retval);3081 mr_asprintf(tmp, "Mondo-restore is exiting (retval=%d) ", retval); 3094 3082 log_to_screen(tmp); 3095 3083 mr_free(tmp); 3096 3084 3097 mr_asprintf( &tmp, "umount %s", bkpinfo->isodir);3085 mr_asprintf(tmp, "umount %s", bkpinfo->isodir); 3098 3086 run_program_and_log_output(tmp, 5); 3099 3087 mr_free(tmp); … … 3105 3093 } // for b0rken distros 3106 3094 if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) { 3107 mr_asprintf( &tmp, "rm -Rf %s", bkpinfo->tmpdir);3095 mr_asprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir); 3108 3096 system(tmp); 3109 3097 mr_free(tmp);
Note:
See TracChangeset
for help on using the changeset viewer.