Changeset 1080 in MondoRescue for branches/stable/mondo/src/mondorestore
- Timestamp:
- Jan 28, 2007, 7:04:41 PM (17 years ago)
- Location:
- branches/stable/mondo/src/mondorestore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/mondorestore/mondo-prep.c
r1067 r1080 1 1 /*************************************************************************** 2 mondo-prep.c - description 3 ----------------- 4 5 begin: Fri Apr 19 16:40:35 EDT 2002 6 copyright : (C) 2002 Mondo Hugo Rabson 7 email : Hugo Rabson <hugorabson@msn.com> 8 edited by : by Stan Benoit 4/2002 9 email : troff@nakedsoul.org 10 cvsid : $Id$ 11 ***************************************************************************/ 12 13 /*************************************************************************** 14 * * 15 * This program is free software; you can redistribute it and/or modify * 16 * it under the terms of the GNU General Public License as published by * 17 * the Free Software Foundation; either version 2 of the License, or * 18 * (at your option) any later version. * 19 * * 20 ***************************************************************************/ 21 22 /* mondo-prep.c Hugo Rabson 23 24 25 26 07/20 27 - when starting RAID, don't do it twice :) 28 - moved Joshua's new get_phys_size_of_drive() code 29 from resize_drive... into get_phys_size_of_drive() 30 31 06/29 32 - make sure software RAID devices are formatted IF user says they're to be 33 - drivelist is struct now, not char[][] 34 35 06/26 36 - drop make_relevant_partition_bootable(); do it yourself in C (mostly) 37 - offer to reboot if partition table is locked up by the kernel 38 39 06/22 40 - be sure not to resize non-NTFS images when restoring 41 - set non-NTFS images' partition types properly 42 43 06/19 44 - shut down all LVMs and VGs before prepping 45 46 05/07 47 - usage of parted2fdisk instead of fdisk alone (ia32/ia64 compatibility) 48 BCO 49 50 03/31 51 - rewrote partitioning and formatting code to call fdisk once per disk 52 53 10/21/2003 54 - suspend/resume Newt gui before/after calling do_my_funky_lvm_stuff() 55 56 10/20 57 - rewrote format_everything() - what a mess it was. 58 It now does things in three phases:- 59 - formats software RAID devices (/dev/md0, etc.) 60 - formats and configures LVM devices 61 - formats regular partitions (/dev/hda1, /dev/sdb2, etc.) 62 and any LVMs recently prepped 63 64 10/07 65 - use strstr(format, "raid") instead of strcmp(format,"raid") to determin 66 if partition is a RAID component 67 68 09/23 69 - better comments 70 71 09/18 72 - better logging of RAID activity 73 74 05/05 75 - added Joshua Oreman's FreeBSD patches 76 77 04/30 78 - added textonly mode 79 80 04/24 81 - added lots of assert()'s and log_OS_error()'s 82 83 04/21 84 - format_everything() --- don't let bar go too far 85 - mkfs -c to check for bad blocks when formatting 86 87 04/04 88 - misc clean-up (Tom Mortell) 89 90 01/15/2003 91 - added code for LVM and SW Raid (Brian Borgeson) 92 93 12/10/2002 94 - line 1238: friendlier output 95 96 11/20 97 - when wiping a given device in preparation for partitioning + formatting 98 it, don't wipe the MBR; just the partition table. That allows for 99 stupid-ass Compaq users who like to play with their MBR's. 100 - disable mountlist.txt-->mountlist.txt.pre-resize copying (superfluous) 101 102 09/09 103 - run_program_and_log_output() now takes boolean operator to specify 104 whether it will log its activities in the event of _success_ 105 106 07/01 - 07/31 107 - added hooks to libmondo 108 - RAID enhancements (Philippe de Muyter) 109 110 01/01 - 03/31 111 - partition_device() will refuse to partition /dev/mdX now (cos it's a 112 virtual drive); however, it will return 0 (i.e. not an error) 113 - make_list_of_drives() will exclude /dev/md* from list 114 - mkreiserfs -ff instead of -q (Andy Glass) 115 - don't resize drive if drive not found (or if its size cannot be det'd) 116 - when generating list of drives from mountlist, skip the 'p' at the end 117 of drive name if /dev/ida/ or /dev/cciss/; just do it (Michael Eisenberg) 118 - don't specify journal size when formatting ext3 119 (used to have -Jsize=10 in the call to mkfs) 120 - handles files >2GB in size 121 - format interactively, if Interactive Mode 122 - removed reference to g_tape_size 123 - when executing /tmp/i-want-my-lvm, only record the error# if the command 124 was _not_ an 'insmod' command 125 - pass partition size to fdisk in Kilobytes now, not Megabytes 126 - log fdisk's output to /tmp/mondo-restore.log if it fails 127 - don't try to format partitions of type 'image' 128 - don't type to set types of 'image' partitions 129 - if format code is 1 or 2 chars then assume it is a hex string 130 - took out all '/ /' comments 131 - don't extrapolate/add partition from RAID dev to mountlist if it's already 132 present in mountlist 133 - less repetitive logging in the event of vacuum-packing of last part'n 134 - no extrapolation at all: RAID partitions should be listed in mountlist 135 already, thanks to either Mindi v0.5x or the mountlist editor itself 136 - no longer say, 'and logging to...' when setting a partition's type 137 - don't run mkfs on RAID partitions (/dev/hd*, /dev/sd*); just set type 138 - the setting of a partition's type now takes place in a separate subroutine 139 from the subroutine that actually creates the partition 140 - no need to set type if 83: 83 is the default (under fdisk) 141 - turned on '-Wall'; cleaned up some cruft 142 - if vacuum-packing partition (i.e. size=0MB --> max) then say, "(maximum)" 143 not, "(0 MB)" 144 145 11/22/2001 146 - preliminary code review 147 - created on Nov 22nd, 2001 2 * $Id$ 148 3 */ 149 4 … … 162 17 #include <linux/hdreg.h> 163 18 #include <math.h> 19 #include "mr_mem.h" 164 20 165 21 … … 220 76 malloc_string(command); 221 77 malloc_string(tmp); 222 buf = m alloc(blocksize);78 buf = mr_malloc(blocksize); 223 79 if (does_file_exist("/tmp/i-want-my-lvm")) // FIXME - cheating :) 224 80 { 225 drivelist = m alloc(sizeof(struct list_of_disks));81 drivelist = mr_malloc(sizeof(struct list_of_disks)); 226 82 make_list_of_drives_in_mountlist(mountlist, drivelist); 227 83 for (lino = 0; lino < drivelist->entries; lino++) { … … 274 130 } 275 131 // Still here? Cool! 276 paranoid_free(command);277 paranoid_free(tmp);132 mr_free(command); 133 mr_free(tmp); 278 134 log_msg(1, "Cool. I didn't have to wipe anything."); 279 135 } … … 384 240 malloc_string(vgremove_sz); 385 241 // malloc_string(do_this_last); // postpone lvcreate call if necessary 386 command = m alloc(512);242 command = mr_malloc(512); 387 243 388 244 // do_this_last[0] = '\0'; … … 549 405 log_msg(1, "Closed i-want-my-lvm. Finished doing funky stuff."); 550 406 end_of_i_want_my_lvm: 551 paranoid_free(tmp);552 paranoid_free(incoming);553 paranoid_free(command);554 paranoid_free(lvscan_sz);555 paranoid_free(lvremove_sz);556 paranoid_free(vgscan_sz);557 paranoid_free(pvscan_sz);558 paranoid_free(vgcreate_sz);559 paranoid_free(vgchange_sz);560 paranoid_free(vgremove_sz);561 // paranoid_free(do_this_last);407 mr_free(tmp); 408 mr_free(incoming); 409 mr_free(command); 410 mr_free(lvscan_sz); 411 mr_free(lvremove_sz); 412 mr_free(vgscan_sz); 413 mr_free(pvscan_sz); 414 mr_free(vgcreate_sz); 415 mr_free(vgchange_sz); 416 mr_free(vgremove_sz); 417 // mr_free(do_this_last); 562 418 system("sync"); 563 419 system("sync"); … … 686 542 } 687 543 } 688 paranoid_free(incoming);689 paranoid_free(tmp);544 mr_free(incoming); 545 mr_free(tmp); 690 546 691 547 return (0); … … 734 590 for (j = 1; j < raidlist->el[i].data_disks.entries; j++) { 735 591 asprintf(&strtmp, "%s", devices); 736 paranoid_free(devices);592 mr_free(devices); 737 593 asprintf(&devices, "%s %s", strtmp, 738 594 raidlist->el[i].data_disks.el[j].device); 739 paranoid_free(strtmp);595 mr_free(strtmp); 740 596 } 741 597 for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) { 742 598 asprintf(&strtmp, "%s", devices); 743 paranoid_free(devices);599 mr_free(devices); 744 600 asprintf(&devices, "%s %s", strtmp, 745 601 raidlist->el[i].spare_disks.el[j].device); 746 paranoid_free(strtmp);602 mr_free(strtmp); 747 603 } 748 604 // translate RAID level … … 765 621 if (raidlist->el[i].parity != -1) { 766 622 asprintf(&strtmp, "%s", program); 767 paranoid_free(program);623 mr_free(program); 768 624 switch(raidlist->el[i].parity) { 769 625 case 0: … … 783 639 break; 784 640 } 785 paranoid_free(strtmp);641 mr_free(strtmp); 786 642 } 787 643 if (raidlist->el[i].chunk_size != -1) { 788 644 asprintf(&strtmp, "%s", program); 789 paranoid_free(program);645 mr_free(program); 790 646 asprintf(&program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size); 791 paranoid_free(strtmp);647 mr_free(strtmp); 792 648 } 793 649 if (raidlist->el[i].spare_disks.entries > 0) { 794 650 asprintf(&strtmp, "%s", program); 795 paranoid_free(program);651 mr_free(program); 796 652 asprintf(&program, "%s --spare-devices=%d", strtmp, 797 653 raidlist->el[i].spare_disks.entries); 798 paranoid_free(strtmp);654 mr_free(strtmp); 799 655 } 800 656 asprintf(&strtmp, "%s", program); 801 paranoid_free(program);657 mr_free(program); 802 658 asprintf(&program, "%s %s", strtmp, devices); 803 paranoid_free(strtmp);659 mr_free(strtmp); 804 660 res = run_program_and_log_output(program, 1); 805 661 // free memory 806 paranoid_free(devices);807 paranoid_free(level);808 paranoid_free(program);662 mr_free(devices); 663 mr_free(level); 664 mr_free(program); 809 665 // return to calling instance 810 666 return res; … … 845 701 sprintf(tmp, "Not formatting %s (it is a RAID disk)", device); 846 702 log_it(tmp); 847 paranoid_free(program);848 paranoid_free(tmp);703 mr_free(program); 704 mr_free(tmp); 849 705 return (0); 850 706 } … … 852 708 if (strcmp(format, "swap") == 0) { 853 709 log_it("Not formatting %s - it's swap", device); 854 paranoid_free(program);855 paranoid_free(tmp);710 mr_free(program); 711 mr_free(tmp); 856 712 return (0); 857 713 } … … 862 718 device, format); 863 719 log_it(tmp); 864 paranoid_free(program);865 paranoid_free(tmp);720 mr_free(program); 721 mr_free(tmp); 866 722 return (0); 867 723 } … … 869 725 sprintf(tmp, "%s is mounted - cannot format it ", device); 870 726 log_to_screen(tmp); 871 paranoid_free(program);872 paranoid_free(tmp);727 mr_free(program); 728 mr_free(tmp); 873 729 return (1); 874 730 } … … 986 842 if (!strcmp(format, "lvm")) { 987 843 log_msg(1, "Don't format %s - it's part of an lvm volume", device); 988 paranoid_free(program);989 paranoid_free(tmp);844 mr_free(program); 845 mr_free(tmp); 990 846 return (0); 991 847 } … … 1026 882 1027 883 log_to_screen(tmp); 1028 paranoid_free(program);1029 paranoid_free(tmp);884 mr_free(program); 885 mr_free(tmp); 1030 886 system("sync"); 1031 887 sleep(1); … … 1253 1109 system("clear"); 1254 1110 newtResume(); 1255 paranoid_free(tmp);1111 mr_free(tmp); 1256 1112 return (retval); 1257 1113 } … … 1308 1164 previous_devno = current_devno; 1309 1165 } 1310 paranoid_free(tmp);1166 mr_free(tmp); 1311 1167 return (previous_devno); 1312 1168 } … … 1649 1505 if (!pout_to_fdisk) { 1650 1506 log_to_screen("Cannot call parted2fdisk to configure %s", drivename); 1651 paranoid_free(device_str);1652 paranoid_free(format);1653 paranoid_free(tmp);1507 mr_free(device_str); 1508 mr_free(format); 1509 mr_free(tmp); 1654 1510 return (1); 1655 1511 } … … 1686 1542 ("Warning! Unable to make the drive bootable."); 1687 1543 } 1688 paranoid_free(device_str);1689 paranoid_free(format);1690 paranoid_free(tmp);1544 mr_free(device_str); 1545 mr_free(format); 1546 mr_free(tmp); 1691 1547 return r; 1692 1548 } … … 1777 1633 log_to_screen 1778 1634 ("You must leave at least one partition spare as the Extended partition."); 1779 paranoid_free(device_str);1780 paranoid_free(format);1781 paranoid_free(tmp);1635 mr_free(device_str); 1636 mr_free(format); 1637 mr_free(tmp); 1782 1638 return (1); 1783 1639 } … … 1825 1681 } 1826 1682 } 1827 paranoid_free(device_str);1828 paranoid_free(format);1829 paranoid_free(tmp);1683 mr_free(device_str); 1684 mr_free(format); 1685 mr_free(tmp); 1830 1686 return (retval); 1831 1687 } … … 1877 1733 sprintf(tmp, "Not partitioning %s - it is a virtual drive", drive); 1878 1734 log_it(tmp); 1879 paranoid_free(program);1880 paranoid_free(partition_name);1881 paranoid_free(tmp);1882 paranoid_free(logfile);1883 paranoid_free(output);1735 mr_free(program); 1736 mr_free(partition_name); 1737 mr_free(tmp); 1738 mr_free(logfile); 1739 mr_free(output); 1884 1740 return (0); 1885 1741 } … … 1898 1754 partition_name); 1899 1755 log_to_screen(tmp); 1900 paranoid_free(program);1901 paranoid_free(partition_name);1902 paranoid_free(tmp);1903 paranoid_free(logfile);1904 paranoid_free(output);1756 mr_free(program); 1757 mr_free(partition_name); 1758 mr_free(tmp); 1759 mr_free(logfile); 1760 mr_free(output); 1905 1761 return (1); 1906 1762 /* … … 1933 1789 log_to_screen 1934 1790 ("You need to leave at least one partition free, for 'extended/logical'"); 1935 paranoid_free(program);1936 paranoid_free(partition_name);1937 paranoid_free(tmp);1938 paranoid_free(logfile);1939 paranoid_free(output);1791 mr_free(program); 1792 mr_free(partition_name); 1793 mr_free(tmp); 1794 mr_free(logfile); 1795 mr_free(output); 1940 1796 return (1); 1941 1797 } else { … … 2056 1912 g_current_progress++; 2057 1913 log_it("partition_device() --- leaving"); 2058 paranoid_free(program);2059 paranoid_free(partition_name);2060 paranoid_free(tmp);2061 paranoid_free(logfile);2062 paranoid_free(output);1914 mr_free(program); 1915 mr_free(partition_name); 1916 mr_free(tmp); 1917 mr_free(logfile); 1918 mr_free(output); 2063 1919 return (retval); 2064 1920 } … … 2087 1943 /** end ************************************************************/ 2088 1944 2089 drivelist = m alloc(sizeof(struct list_of_disks));1945 drivelist = mr_malloc(sizeof(struct list_of_disks)); 2090 1946 assert(mountlist != NULL); 2091 1947 … … 2146 2002 system("clear"); 2147 2003 newtResume(); 2148 paranoid_free(drivelist);2004 mr_free(drivelist); 2149 2005 return (retval); 2150 2006 } … … 2290 2146 } 2291 2147 2292 paranoid_free(partition);2293 paranoid_free(command);2294 paranoid_free(output);2295 paranoid_free(tmp);2296 paranoid_free(partcode);2297 paranoid_free(logfile);2148 mr_free(partition); 2149 mr_free(command); 2150 mr_free(output); 2151 mr_free(tmp); 2152 mr_free(partcode); 2153 mr_free(logfile); 2298 2154 2299 2155 return (res); … … 2448 2304 "r"); 2449 2305 if (!fin) { 2450 paranoid_free(dev);2451 paranoid_free(incoming);2306 mr_free(dev); 2307 mr_free(incoming); 2452 2308 return (1); 2453 2309 } … … 2460 2316 if (!fin) { 2461 2317 log_OS_error("/proc/mdstat"); 2462 paranoid_free(dev);2463 paranoid_free(incoming);2318 mr_free(dev); 2319 mr_free(incoming); 2464 2320 return (1); 2465 2321 } … … 2482 2338 log_msg(1, "Warning - unable to stop some RAID devices"); 2483 2339 } 2484 paranoid_free(dev);2485 paranoid_free(incoming);2340 mr_free(dev); 2341 mr_free(incoming); 2486 2342 system("sync"); 2487 2343 system("sync"); … … 2546 2402 res = 0; 2547 2403 } 2548 paranoid_free(tmp);2404 mr_free(tmp); 2549 2405 return (res); 2550 2406 } … … 2588 2444 } 2589 2445 original_size_of_drive = original_size_of_drive / 1024; 2590 paranoid_free(tmp);2446 mr_free(tmp); 2591 2447 return (original_size_of_drive); 2592 2448 } … … 2638 2494 if (strncmp(drive_name, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB)) 2639 2495 == 0) { 2640 paranoid_free(tmp);2496 mr_free(tmp); 2641 2497 return; 2642 2498 } … … 2652 2508 if (current_size_of_drive <= 0) { 2653 2509 log_it("Not resizing to match %s - can't find drive", drive_name); 2654 paranoid_free(tmp);2510 mr_free(tmp); 2655 2511 return; 2656 2512 } … … 2659 2515 log_to_screen(tmp); 2660 2516 2661 drivemntlist = m alloc(sizeof(struct mountlist_reference));2517 drivemntlist = mr_malloc(sizeof(struct mountlist_reference)); 2662 2518 drivemntlist->el = 2663 malloc(sizeof(struct mountlist_line *) * MAX_TAPECATALOG_ENTRIES); 2664 2665 if (!drivemntlist) { 2666 fatal_error("Cannot malloc temporary mountlist\n"); 2667 } 2519 mr_malloc(sizeof(struct mountlist_line *) * MAX_TAPECATALOG_ENTRIES); 2520 2668 2521 create_mountlist_for_drive(mountlist, drive_name, drivemntlist); 2669 2522 … … 2677 2530 drive_name); 2678 2531 log_to_screen(tmp); 2679 paranoid_free(tmp);2532 mr_free(tmp); 2680 2533 return; 2681 2534 } … … 2712 2565 final_size = get_phys_size_of_drive(drive_name); 2713 2566 sprintf(tmp, "final_size = %ld MB", final_size); 2714 paranoid_free(tmp);2567 mr_free(tmp); 2715 2568 log_to_screen(tmp); 2716 2569 } … … 2734 2587 /** end *************************************************************/ 2735 2588 2736 drivelist = malloc(sizeof(struct list_of_disks)); 2737 assert(mountlist != NULL); 2589 drivelist = mr_malloc(sizeof(struct list_of_disks)); 2738 2590 2739 2591 if (g_mountlist_fname[0] == '\0') { … … 2753 2605 } 2754 2606 log_to_screen("Mountlist adjusted to suit current hard drive(s)"); 2755 paranoid_free(drivelist);2607 mr_free(drivelist); 2756 2608 } 2757 2609 … … 2798 2650 } 2799 2651 if (tmp_drive_name) 2800 free(tmp_drive_name);2652 mr_free(tmp_drive_name); 2801 2653 } 2802 2654 -
branches/stable/mondo/src/mondorestore/mondo-restore.c
r1077 r1080 1 1 /*************************************************************************** 2 $Id$ 3 restores mondoarchive data 2 * restores mondoarchive data 3 * $Id$ 4 4 ***************************************************************************/ 5 5 … … 20 20 #include "mondo-rstr-compare-EXT.h" 21 21 #include "mondo-rstr-tools-EXT.h" 22 #include "mr_mem.h" 22 23 23 24 extern void twenty_seconds_til_yikes(void); … … 313 314 retval += compare_mode(bkpinfo, mountlist, raidlist); 314 315 } 315 paranoid_free(tmp);316 mr_free(tmp); 316 317 return (retval); 317 318 } … … 631 632 } 632 633 end_of_func: 633 paranoid_free(tmp);634 paranoid_free(fstab_fname);635 paranoid_free(old_restpath);634 mr_free(tmp); 635 mr_free(fstab_fname); 636 mr_free(old_restpath); 636 637 iamhere("Leaving interactive_mode()"); 637 638 return (retval); … … 912 913 assert(bkpinfo != NULL); 913 914 malloc_string(old_restpath); 914 mountlist = malloc(sizeof(struct mountlist_itself)); 915 raidlist = malloc(sizeof(struct raidlist_itself)); 916 if (!mountlist || !raidlist) { 917 fatal_error("Cannot malloc() mountlist and/or raidlist"); 918 } 915 mountlist = mr_malloc(sizeof(struct mountlist_itself)); 916 raidlist = mr_malloc(sizeof(struct raidlist_itself)); 919 917 920 918 strcpy(bkpinfo->restore_path, "/"); … … 966 964 eject_device(bkpinfo->media_device); 967 965 } 968 paranoid_free(old_restpath);969 free(mountlist);970 free(raidlist);966 mr_free(old_restpath); 967 mr_free(mountlist); 968 mr_free(raidlist); 971 969 return (retval); 972 970 } … … 1038 1036 1039 1037 pathname_of_last_file_restored[0] = '\0'; 1040 if (!(bigblk = malloc(TAPE_BLOCK_SIZE))) { 1041 fatal_error("Cannot malloc bigblk"); 1042 } 1038 bigblk = mr_malloc(TAPE_BLOCK_SIZE); 1043 1039 1044 1040 if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) { … … 1295 1291 utime(outfile_fname, ubuf); 1296 1292 } 1297 paranoid_free(bigblk);1298 paranoid_free(checksum);1299 paranoid_free(outfile_fname);1300 paranoid_free(tmp);1301 paranoid_free(bzip2_command);1302 paranoid_free(ntfsprog_command);1303 paranoid_free(suffix);1304 paranoid_free(sz_devfile);1293 mr_free(bigblk); 1294 mr_free(checksum); 1295 mr_free(outfile_fname); 1296 mr_free(tmp); 1297 mr_free(bzip2_command); 1298 mr_free(ntfsprog_command); 1299 mr_free(suffix); 1300 mr_free(sz_devfile); 1305 1301 1306 1302 return (retval); … … 1553 1549 } 1554 1550 1555 paranoid_free(tmp);1556 paranoid_free(outfile_fname);1557 paranoid_free(command);1558 paranoid_free(ntfsprog_command);1559 paranoid_free(sz_devfile);1560 paranoid_free(ntfsprog_fifo);1551 mr_free(tmp); 1552 mr_free(outfile_fname); 1553 mr_free(command); 1554 mr_free(ntfsprog_command); 1555 mr_free(sz_devfile); 1556 mr_free(ntfsprog_fifo); 1561 1557 g_loglevel = old_loglevel; 1562 1558 return (retval); … … 1786 1782 1787 1783 leave_sub: 1788 paranoid_free(command);1789 paranoid_free(tmp);1790 paranoid_free(filelist_name);1791 paranoid_free(filelist_subset_fname);1792 paranoid_free(executable);1793 paranoid_free(temp_log);1794 paranoid_free(xattr_fname);1795 paranoid_free(acl_fname);1784 mr_free(command); 1785 mr_free(tmp); 1786 mr_free(filelist_name); 1787 mr_free(filelist_subset_fname); 1788 mr_free(executable); 1789 mr_free(temp_log); 1790 mr_free(xattr_fname); 1791 mr_free(acl_fname); 1796 1792 log_msg(5, "Leaving"); 1797 1793 return (retval); … … 1988 1984 unlink(afio_fname); 1989 1985 1990 paranoid_free(filelist_subset_fname);1991 paranoid_free(filelist_fname);1992 paranoid_free(afio_fname);1993 paranoid_free(command);1994 paranoid_free(tmp);1986 mr_free(filelist_subset_fname); 1987 mr_free(filelist_fname); 1988 mr_free(afio_fname); 1989 mr_free(command); 1990 mr_free(tmp); 1995 1991 return (retval); 1996 1992 } … … 2137 2133 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2138 2134 } 2139 paranoid_free(xattr_fname);2140 paranoid_free(acl_fname);2141 paranoid_free(tmp);2142 paranoid_free(biggies_whose_EXATs_we_should_set);2143 paranoid_free(pathname_of_last_biggie_restored);2135 mr_free(xattr_fname); 2136 mr_free(acl_fname); 2137 mr_free(tmp); 2138 mr_free(biggies_whose_EXATs_we_should_set); 2139 mr_free(pathname_of_last_biggie_restored); 2144 2140 return (retval); 2145 2141 } … … 2286 2282 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2287 2283 } 2288 paranoid_free(tmp);2289 paranoid_free(tarball_fname);2290 paranoid_free(progress_str);2291 paranoid_free(comment);2284 mr_free(tmp); 2285 mr_free(tarball_fname); 2286 mr_free(progress_str); 2287 mr_free(comment); 2292 2288 2293 2289 return (retval); … … 2457 2453 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2458 2454 } 2459 paranoid_free(biggies_whose_EXATs_we_should_set);2460 paranoid_free(pathname_of_last_biggie_restored);2461 paranoid_free(biggie_fname);2462 paranoid_free(biggie_cksum);2463 paranoid_free(xattr_fname);2464 paranoid_free(acl_fname);2465 paranoid_free(tmp);2455 mr_free(biggies_whose_EXATs_we_should_set); 2456 mr_free(pathname_of_last_biggie_restored); 2457 mr_free(biggie_fname); 2458 mr_free(biggie_cksum); 2459 mr_free(xattr_fname); 2460 mr_free(acl_fname); 2461 mr_free(tmp); 2466 2462 return (retval); 2467 2463 } … … 2603 2599 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2604 2600 } 2605 paranoid_free(tmp);2606 paranoid_free(progress_str);2607 paranoid_free(tmp_fname);2608 paranoid_free(xattr_fname);2609 paranoid_free(acl_fname);2601 mr_free(tmp); 2602 mr_free(progress_str); 2603 mr_free(tmp_fname); 2604 mr_free(xattr_fname); 2605 mr_free(acl_fname); 2610 2606 return (retval); 2611 2607 } … … 2692 2688 kill_petris(); 2693 2689 log_msg(2, "restore_everything() --- leaving"); 2694 paranoid_free(cwd);2695 paranoid_free(newpath);2696 paranoid_free(tmp);2690 mr_free(cwd); 2691 mr_free(newpath); 2692 mr_free(tmp); 2697 2693 return (resA + resB); 2698 2694 } … … 2914 2910 g_text_mode = FALSE; 2915 2911 } // newt :-) 2916 if (! 2917 (bkpinfo = g_bkpinfo_DONTUSETHIS = 2918 malloc(sizeof(struct s_bkpinfo)))) { 2919 fatal_error("Cannot malloc bkpinfo"); 2920 } 2921 if (!(mountlist = malloc(sizeof(struct mountlist_itself)))) { 2922 fatal_error("Cannot malloc mountlist"); 2923 } 2924 if (!(raidlist = malloc(sizeof(struct raidlist_itself)))) { 2925 fatal_error("Cannot malloc raidlist"); 2926 } 2912 bkpinfo = g_bkpinfo_DONTUSETHIS = mr_malloc(sizeof(struct s_bkpinfo)); 2913 mountlist = mr_malloc(sizeof(struct mountlist_itself)); 2914 raidlist = mr_malloc(sizeof(struct raidlist_itself)); 2927 2915 2928 2916 malloc_libmondo_global_strings(); … … 3344 3332 sprintf(tmp, "umount %s", bkpinfo->isodir); 3345 3333 run_program_and_log_output(tmp, 5); 3346 paranoid_free(mountlist);3347 paranoid_free(raidlist);3334 mr_free(mountlist); 3335 mr_free(raidlist); 3348 3336 if (am_I_in_disaster_recovery_mode()) { 3349 3337 run_program_and_log_output("mount / -o remount,rw", 2); … … 3351 3339 paranoid_MR_finish(retval); // frees global stuff plus bkpinfo 3352 3340 free_libmondo_global_strings(); // it's fine to have this here :) really :) 3353 paranoid_free(a);3354 paranoid_free(b);3355 paranoid_free(tmp);3341 mr_free(a); 3342 mr_free(b); 3343 mr_free(tmp); 3356 3344 3357 3345 unlink("/tmp/filelist.full"); -
branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c
r1067 r1080 1 1 /*************************************************************************** 2 mondo-compare.c - compares mondoarchive data 3 ------------------- 4 begin : Fri Apr 25 2003 5 copyright : (C) 2000 by Hugo Rabson 6 email : Hugo Rabson <hugorabson@msn.com> 7 cvsid : $Id$ 8 ***************************************************************************/ 9 10 /*************************************************************************** 11 * * 12 * This program is free software; you can redistribute it and/or modify * 13 * it under the terms of the GNU General Public License as published by * 14 * the Free Software Foundation; either version 2 of the License, or * 15 * (at your option) any later version. * 16 * * 17 ***************************************************************************/ 18 19 /*************************************************************************** 20 * Change Log * 21 *************************************************************************** 22 . 23 24 25 26 10/21/2003 27 - changed "/mnt/cdrom" to MNT_CDROM 28 29 10/18 30 - don't say unknown compressor if no compressor at all 31 32 09/17 33 - cleaned up logging & conversion-to-changed.txt 34 - cleaned up compare_mode() 35 36 09/16 37 - fixed bad malloc(),free() pairs in compare_a_biggiefile() 38 39 09/14 40 - compare_mode() --- a couple of strings were the wrong way round, 41 e.g. changed.txt and changed.files 42 43 05/05 44 - exclude /dev/ * from list of changed files 45 46 04/30 47 - added textonly mode 48 49 04/27 50 - improved compare_mode() to allow for ISO/cd/crazy people 51 52 04/25 53 - first incarnation 2 * compares mondoarchive data 3 * $Id$ 54 4 */ 55 56 5 57 6 #include <pthread.h> … … 207 156 } 208 157 209 paranoid_free(original_cksum_ptr);210 paranoid_free(original_cksum);211 paranoid_free(bigfile_fname_ptr);212 paranoid_free(bigfile_fname);213 paranoid_free(checksum_ptr);214 paranoid_free(checksum);215 paranoid_free(command_ptr);216 paranoid_free(command);217 paranoid_free(tmp_ptr);218 paranoid_free(tmp);158 mr_free(original_cksum_ptr); 159 mr_free(original_cksum); 160 mr_free(bigfile_fname_ptr); 161 mr_free(bigfile_fname); 162 mr_free(checksum_ptr); 163 mr_free(checksum); 164 mr_free(command_ptr); 165 mr_free(command); 166 mr_free(tmp_ptr); 167 mr_free(tmp); 219 168 220 169 return (retval); … … 395 344 } 396 345 unlink(logfile); 397 paranoid_free(command);398 paranoid_free(tmp);399 paranoid_free(filelist_name);400 paranoid_free(logfile);346 mr_free(command); 347 mr_free(tmp); 348 mr_free(filelist_name); 349 mr_free(logfile); 401 350 malloc_string(archiver_exe); 402 351 malloc_string(compressor_exe); … … 494 443 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 495 444 } 496 paranoid_free(tarball_fname);497 paranoid_free(progress_str);498 paranoid_free(tmp);445 mr_free(tarball_fname); 446 mr_free(progress_str); 447 mr_free(tmp); 499 448 return (retval); 500 449 } … … 555 504 } 556 505 557 paranoid_free(tmp);558 paranoid_free(cwd);559 paranoid_free(new);560 paranoid_free(command);506 mr_free(tmp); 507 mr_free(cwd); 508 mr_free(new); 509 mr_free(command); 561 510 562 511 return (resA + resB); … … 663 612 } 664 613 kill_petris(); 665 paranoid_free(tmp);614 mr_free(tmp); 666 615 return (retval); 667 616 } … … 717 666 718 667 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 719 paranoid_free(dir);720 paranoid_free(command);668 mr_free(dir); 669 mr_free(command); 721 670 return (res); 722 671 } … … 761 710 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 762 711 } 763 paranoid_free(dir);764 paranoid_free(command);712 mr_free(dir); 713 mr_free(command); 765 714 return (res); 766 715 } -
branches/stable/mondo/src/mondorestore/mondo-rstr-newt.c
r738 r1080 1 1 /*************************************************************************** 2 mondo-rstr-newt.c - description 3 ----------------- 4 5 begin: Fri Apr 19 16:40:35 EDT 2002 6 copyright : (C) 2002 Mondo Hugo Rabson 7 email : Hugo Rabson <hugorabson@msn.com> 8 edited by : by Stan Benoit 4/2002 9 email : troff@nakedsoul.org 10 cvsid : $Id$ 11 ***************************************************************************/ 12 13 /*************************************************************************** 14 * * 15 * This program is free software; you can redistribute it and/or modify * 16 * it under the terms of the GNU General Public License as published by * 17 * the Free Software Foundation; either version 2 of the License, or * 18 * (at your option) any later version. * 19 * * 20 ***************************************************************************/ 21 /* mondo-rstr-newt.c Hugo Rabson 22 23 24 07/12 25 - wider mountlist entry editor window 26 27 03/28/2004 28 - removed g_mountlist_fname 29 30 07/02/2003 31 - fixed calls to popup_and_get_string() 32 33 06/05 34 - cleaned up get_isodir_info() 35 36 05/02 37 - added strip_path() to improve file list display for long paths (Conor) 38 39 04/24 40 - added lots of assert()'s and log_OS_error()'s 41 42 04/08/2003 43 - commented out call to sort_mountlist_by_device(), just in case it's 44 futzing with LVM/RAID users 45 46 08/21/2002 47 - fix MOUNTLIST_FNAME and RAIDTAB_FNAME if Reload button finds them empty 48 49 08/19 50 - fixed what_number_cd_is_this() to take bkpinfo as parameter 51 52 07/01 - 07/31 53 - renamed from mondo-newt.c to mondo-rstr-newt.c 54 - moved lots of subroutines to libmondo-newt.c 55 - added hooks to libmondo 56 - better handling of yes/no/YES/NO 57 - better "% done" feedback (Philippe de Muyter) 58 59 05/01 - 06/30 60 - trim trailing \n from fgets() in a couple of functions 61 - expanded "May I write mountlist?" message 62 - replace scanf() with a properly restricted fgets() (Troff) 63 64 02/01 - 02/28/2002 65 - allow up to 50 chars in popup_and_get_string()'s input field 66 - if g_current_progress > g_maximum_progress then g_current_progress=g_max... 67 to stop the progress bar from shooting off the RHS of the screen :) 68 - beefed up the RAID-related logging a bit 69 - don't complain if partition format is a number (1-255) 70 - if hard disk does not exist then warn user when editing mountlist 71 - when running 'eject -t', log its output 72 73 [...] 74 75 08/09/2001 76 - created 2 * $Id$ 77 3 */ 4 5 #include "mr_mem.h" 78 6 79 7 … … 1650 1578 malloc_string(sz_parity_disks); 1651 1579 malloc_string(sz_failed_disks); 1652 if (!(bkp_raidrec = malloc(sizeof(struct raid_device_record)))) { 1653 fatal_error("Cannot malloc space for raidrec"); 1654 } 1580 bkp_raidrec = mr_malloc(sizeof(struct raid_device_record)); 1655 1581 1656 1582 log_it("Started edit_raidlist_entry"); … … 1727 1653 calculate_raid_device_size(mountlist, raidlist, 1728 1654 raidrec->raid_device); 1729 paranoid_free(title_of_editraidForm_window);1730 paranoid_free(sz_raid_level);1731 paranoid_free(sz_data_disks);1732 paranoid_free(sz_spare_disks);1733 paranoid_free(sz_parity_disks);1734 paranoid_free(sz_failed_disks);1735 paranoid_free(bkp_raidrec);1655 mr_free(title_of_editraidForm_window); 1656 mr_free(sz_raid_level); 1657 mr_free(sz_data_disks); 1658 mr_free(sz_spare_disks); 1659 mr_free(sz_parity_disks); 1660 mr_free(sz_failed_disks); 1661 mr_free(bkp_raidrec); 1736 1662 #endif 1737 1663 } … … 1781 1707 struct mountlist_itself *unallocparts; 1782 1708 1783 unallocparts = m alloc(sizeof(struct mountlist_itself));1709 unallocparts = mr_malloc(sizeof(struct mountlist_itself)); 1784 1710 1785 1711 log_it("Started edit_raidlist_entry"); … … 2816 2742 malloc_string(sz_res); 2817 2743 malloc_string(header_text); 2818 if (!(bkp_raidrec = malloc(sizeof(struct raid_device_record)))) { 2819 fatal_error("Cannot malloc space for raidrec"); 2820 } 2821 if (!(bkp_disklist = malloc(sizeof(struct list_of_disks)))) { 2822 fatal_error("Cannot malloc space for disklist"); 2823 } 2824 if (!(bkp_raidlist = malloc(sizeof(struct raidlist_itself)))) { 2825 fatal_error("Cannot malloc space for raidlist"); 2826 } 2827 if (! 2828 (unallocated_raid_partitions = 2829 malloc(sizeof(struct mountlist_itself)))) { 2830 fatal_error("Cannot malloc space for unallocated_raid_partitions"); 2831 } 2744 bkp_raidrec = mr_malloc(sizeof(struct raid_device_record)); 2745 bkp_disklist = mr_malloc(sizeof(struct list_of_disks)); 2746 bkp_raidlist = mr_malloc(sizeof(struct raidlist_itself)); 2747 unallocated_raid_partitions = mr_malloc(sizeof(struct mountlist_itself)); 2832 2748 2833 2749 memcpy((void *) bkp_raidlist, (void *) raidlist, … … 2920 2836 sizeof(struct list_of_disks)); 2921 2837 } 2922 paranoid_free(tmp);2923 paranoid_free(help_text);2924 paranoid_free(title_of_window);2925 paranoid_free(sz_res);2926 paranoid_free(header_text);2927 paranoid_free(bkp_raidrec);2928 paranoid_free(bkp_disklist);2929 paranoid_free(bkp_raidlist);2930 paranoid_free(unallocated_raid_partitions);2838 mr_free(tmp); 2839 mr_free(help_text); 2840 mr_free(title_of_window); 2841 mr_free(sz_res); 2842 mr_free(header_text); 2843 mr_free(bkp_raidrec); 2844 mr_free(bkp_disklist); 2845 mr_free(bkp_raidlist); 2846 mr_free(unallocated_raid_partitions); 2931 2847 } 2932 2848 #endif -
branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c
r1067 r1080 1 1 /*************************************************************************** 2 mondo-rstr-tools.c - description 3 ----------------- 4 5 begin: Sun Sep 21 16:40:35 EDT 2003 6 copyright : (C) 2002 Mondo Hugo Rabson 7 email : Hugo Rabson <hugorabson@msn.com> 8 edited by : by Stan Benoit ?/2003 9 email : troff@nakedsoul.org 10 cvsid : $Id: mondo-rstr-tools.c 11 ***************************************************************************/ 12 13 /*************************************************************************** 14 * * 15 * This program is free software; you can redistribute it and/or modify * 16 * it under the terms of the GNU General Public License as published by * 17 * the Free Software Foundation; either version 2 of the License, or * 18 * (at your option) any later version. * 19 * * 20 ***************************************************************************/ 21 /* mondo-rstr-tools.c Hugo Rabson 22 23 24 07/27 25 - if the user is foolish enough to use /dev/md0 as boot device, 26 call lilo -M /dev/hda to make sure lilo does its job properly 27 - better NFS+nuke support 28 29 07/20 30 - use backup's i-want-my-lvm file 31 - be sure to use archives' raidtab when restoring 32 33 07/18 34 - use /tmp/isodir for NFS if DR mode 35 - better support of users who boot from LVM CD and nuke-restore non-LVM backups 36 37 07/12 38 - bugfix to allow user to burn ISOs to CDs and restore from CDs (not original src) 39 40 06/29 41 - mount ext3 partitions as ext2, just in case :) 42 43 06/26 44 - delete make_relevant_partition_bootable() 45 46 06/19 47 - futzed with the call to mount floppy, to stop it from locking up on my AMD64 system 48 49 06/14 50 - shell out to /mnt/RESTORING chroot in order to let user install GRUB 51 manually if automatic GRUB installation fails 52 53 06/15 54 - Added check for different 'isodir' chosen by user than stored in the archive 55 Conor Daly <conor.daly@met.ie> 56 57 04/17 58 - replaced INTERNAL_TAPE_BLK_SIZE with bkpinfo->internal_tape_block_size 59 60 04/09 61 - don't try to mount CD if tape bkp 62 63 04/03 64 - trying to copy tmp/mondo-restore.cfg to itself - silly! - fixed 65 66 04/02 67 - when extracting cfg file and mountlist from all.tar.gz (tape copy), 68 use block size of INTERNAL_TAPE_BLK_SIZE, not TAPE_BLOCK_SIZE 69 70 02/21 71 - don't use 'mv -v' cos Busybox won't support it 72 73 02/09 74 - make hole for cfg file before moving it (line 2094 or so) 75 76 02/03 77 - changed a couple of refs to filelist.full, to filelist.full.gz 78 79 01/16/2004 80 - instead of copying filelist, use 'ln -sf' to link to original; 81 saves space 82 83 11/20/2003 84 - also retrieve /tmp/mountlist.txt if user wants 85 86 11/16 87 - fixed NFS path bug affecting the extractions of filelist/biggielist 88 during selective restore 89 90 11/02 91 - fixed mount_cdrom() to run properly w/ nfs restores 92 - mount_device() returns 0 if swap mount fails cos swap isn't crucial 93 94 10/17 95 - run_grub() uses MNT_RESTORING instead of "/mnt/RESTORING" 96 97 10/26 98 - cleaned up run_grub() 99 100 10/25 101 - fixed mount_cdrom() to run properly w/ nfs restores 102 103 10/21 104 - mount_device() returns 0 if swap mount fails cos swap isn't crucial 105 106 10/15 107 - run_grub() now uses its initiative instead 108 of calling grub-install 109 110 10/10 111 - don't leave copies of filelist.full lying around, clogging up 112 the ramdisk, there's a good fellow :-) 113 114 10/02 115 - added 'dvd' to the range of media types I'll understand 116 - fixed iso->cdr problem (thanks, Stan Benoit & Fred Beondo) 117 118 09/24 119 - try lots of tape devs if /dev/st0 fails 120 121 09/23/2003 122 - first incarnation 2 * $Id$ 123 3 */ 124 4 … … 132 12 //#include "mondo-rstr-compare-EXT.h" 133 13 #include "mondo-rstr-tools.h" 14 #include "mr_mem.h" 134 15 135 16 extern bool g_sigpipe_caught; … … 174 55 void free_MR_global_filenames() 175 56 { 176 paranoid_free(g_biggielist_txt);177 paranoid_free(g_filelist_full);178 paranoid_free(g_filelist_imagedevs);179 // paranoid_free (g_imagedevs_pot );180 paranoid_free(g_imagedevs_restthese);181 paranoid_free(g_mondo_cfg_file);182 paranoid_free(g_mountlist_fname);183 paranoid_free(g_mondo_home);184 paranoid_free(g_tmpfs_mountpt);185 paranoid_free(g_isodir_device);186 paranoid_free(g_isodir_format);57 mr_free(g_biggielist_txt); 58 mr_free(g_filelist_full); 59 mr_free(g_filelist_imagedevs); 60 // mr_free (g_imagedevs_pot ); 61 mr_free(g_imagedevs_restthese); 62 mr_free(g_mondo_cfg_file); 63 mr_free(g_mountlist_fname); 64 mr_free(g_mondo_home); 65 mr_free(g_tmpfs_mountpt); 66 mr_free(g_isodir_device); 67 mr_free(g_isodir_format); 187 68 188 69 } … … 213 94 assert_string_is_neither_NULL_nor_zerolength(outfname); 214 95 215 incoming_ptr = malloc(sizeof(incoming)); 216 if (incoming_ptr == NULL) { 217 fprintf(stderr, "Out of Memory\n"); 218 exit(EXIT_FAILURE); 219 } 220 221 question_ptr = malloc(sizeof(question)); 222 if (question_ptr == NULL) { 223 fprintf(stderr, "Out of Memory\n"); 224 exit(EXIT_FAILURE); 225 } 96 incoming_ptr = mr_malloc(sizeof(incoming)); 97 question_ptr = mr_malloc(sizeof(question)); 226 98 227 99 memset(incoming_ptr, '\0', sizeof(incoming)); … … 253 125 254 126 /*** free memory ***********/ 255 paranoid_free(incoming_ptr);127 mr_free(incoming_ptr); 256 128 incoming_ptr = NULL; 257 paranoid_free(question_ptr);129 mr_free(question_ptr); 258 130 question_ptr = NULL; 259 131 … … 341 213 retval = 0; 342 214 } 343 paranoid_free(mountpt);344 paranoid_free(command);345 paranoid_free(orig_fname);215 mr_free(mountpt); 216 mr_free(command); 217 mr_free(orig_fname); 346 218 return (retval); 347 219 … … 406 278 sprintf(command, "grep -E '^%s$' %s", file, list_fname); 407 279 res = run_program_and_log_output(command, FALSE); 408 paranoid_free(command);409 paranoid_free(file);410 paranoid_free(tmp);280 mr_free(command); 281 mr_free(file); 282 mr_free(tmp); 411 283 if (res) { 412 284 return (FALSE); … … 500 372 log_msg(2, "%ld: bkpinfo->isodir is now %s", __LINE__, 501 373 bkpinfo->isodir); 502 paranoid_free(mount_isodir_command);503 paranoid_free(tmp);504 paranoid_free(command);374 mr_free(mount_isodir_command); 375 mr_free(tmp); 376 mr_free(command); 505 377 return (retval); 506 378 } … … 519 391 "kill `ps 2> /dev/null | grep petris 2> /dev/null | grep -v grep | cut -d' ' -f2` 2> /dev/null"); 520 392 paranoid_system(command); 521 paranoid_free(command);393 mr_free(command); 522 394 } 523 395 … … 556 428 } 557 429 if (!does_file_exist(rclocal_fname)) { 558 paranoid_free(rclocal_fname);559 paranoid_free(newfile_fname);560 paranoid_free(tmp);430 mr_free(rclocal_fname); 431 mr_free(newfile_fname); 432 mr_free(tmp); 561 433 return (1); 562 434 } … … 582 454 sprintf(tmp, "chmod +x \"%s\"", newfile_fname); 583 455 run_program_and_log_output(tmp, FALSE); 584 paranoid_free(rclocal_fname);585 paranoid_free(newfile_fname);586 paranoid_free(tmp);456 mr_free(rclocal_fname); 457 mr_free(newfile_fname); 458 mr_free(tmp); 587 459 return (0); 588 460 } … … 613 485 malloc_string(these_failed); 614 486 assert(p_external_copy_of_mountlist != NULL); 615 mountlist = m alloc(sizeof(struct mountlist_itself));487 mountlist = mr_malloc(sizeof(struct mountlist_itself)); 616 488 memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist, 617 489 sizeof(struct mountlist_itself)); … … 684 556 } 685 557 run_program_and_log_output("df -m", 3); 686 paranoid_free(mountlist);687 paranoid_free(tmp);688 paranoid_free(format);689 paranoid_free(these_failed);558 mr_free(mountlist); 559 mr_free(tmp); 560 mr_free(format); 561 mr_free(these_failed); 690 562 return (retval); 691 563 } … … 720 592 || bkpinfo->backup_media_type == udev) { 721 593 log_msg(8, "Tape/udev. Therefore, no need to mount CDROM."); 722 paranoid_free(mount_cmd);594 mr_free(mount_cmd); 723 595 return 0; 724 596 } … … 726 598 if (!run_program_and_log_output("mount | grep -F " MNT_CDROM, FALSE)) { 727 599 log_msg(2, "mount_cdrom() - CD already mounted. Fair enough."); 728 paranoid_free(mount_cmd);600 mr_free(mount_cmd); 729 601 return (0); 730 602 } … … 807 679 log_msg(2, "Mounted CD-ROM drive OK"); 808 680 } 809 paranoid_free(mount_cmd);681 mr_free(mount_cmd); 810 682 return (res); 811 683 } … … 918 790 } 919 791 920 paranoid_free(tmp);921 paranoid_free(command);922 paranoid_free(mountdir);923 paranoid_free(mountpoint);924 paranoid_free(additional_parameters);792 mr_free(tmp); 793 mr_free(command); 794 mr_free(mountdir); 795 mr_free(mountpoint); 796 mr_free(additional_parameters); 925 797 926 798 return (res); … … 1107 979 read_cfg_var(cfg_file, "acl", value); 1108 980 if (strstr(value, "TRUE")) { 1109 asprintf(&g_getfacl,"setfacl");981 mr_asprintf(&g_getfacl,"setfacl"); 1110 982 log_msg(1, "We will restore ACLs"); 1111 983 if (! find_home_of_exe("setfacl")) { … … 1115 987 read_cfg_var(cfg_file, "xattr", value); 1116 988 if (strstr(value, "TRUE")) { 1117 asprintf(&g_getfattr,"setfattr");989 mr_asprintf(&g_getfattr,"setfattr"); 1118 990 log_msg(1, "We will restore XATTRs"); 1119 991 if (! find_home_of_exe("setfattr")) { … … 1290 1162 } 1291 1163 g_backup_media_type = bkpinfo->backup_media_type; 1292 paranoid_free(value);1293 paranoid_free(tmp);1294 paranoid_free(command);1295 paranoid_free(iso_mnt);1296 paranoid_free(iso_path);1297 paranoid_free(old_isodir);1164 mr_free(value); 1165 mr_free(tmp); 1166 mr_free(command); 1167 mr_free(iso_mnt); 1168 mr_free(iso_path); 1169 mr_free(old_isodir); 1298 1170 return (0); 1299 1171 … … 1480 1352 } 1481 1353 1482 paranoid_free(command);1483 paranoid_free(tmp);1354 mr_free(command); 1355 mr_free(tmp); 1484 1356 return (filelist); 1485 1357 } … … 1514 1386 1515 1387 res = run_program_and_log_output(command, 5); 1516 paranoid_free(tmp);1517 paranoid_free(command);1388 mr_free(tmp); 1389 mr_free(command); 1518 1390 return (res); 1519 1391 } … … 1593 1465 log_to_screen("Your boot loader ran OK"); 1594 1466 } 1595 paranoid_free(device);1596 paranoid_free(tmp);1597 paranoid_free(name);1467 mr_free(device); 1468 mr_free(tmp); 1469 mr_free(name); 1598 1470 return (retval); 1599 1471 } … … 1739 1611 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 1740 1612 } 1741 paranoid_free(rootdev);1742 paranoid_free(rootdrive);1743 paranoid_free(conffile);1744 paranoid_free(command);1745 paranoid_free(boot_device);1746 paranoid_free(tmp);1747 paranoid_free(editor);1613 mr_free(rootdev); 1614 mr_free(rootdrive); 1615 mr_free(conffile); 1616 mr_free(command); 1617 mr_free(boot_device); 1618 mr_free(tmp); 1619 mr_free(editor); 1748 1620 1749 1621 return (res); … … 1813 1685 res = TRUE; 1814 1686 } 1815 paranoid_free(command);1816 paranoid_free(tmp);1817 paranoid_free(editor);1687 mr_free(command); 1688 mr_free(tmp); 1689 mr_free(editor); 1818 1690 return (res); 1819 1691 } … … 1924 1796 " lilo -M /dev/sda", 3); 1925 1797 } 1926 paranoid_free(command);1927 paranoid_free(tmp);1928 paranoid_free(editor);1798 mr_free(command); 1799 mr_free(tmp); 1800 mr_free(editor); 1929 1801 return (res); 1930 1802 } … … 2006 1878 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2007 1879 } 2008 paranoid_free(command);2009 paranoid_free(boot_device);2010 paranoid_free(tmp);2011 paranoid_free(editor);1880 mr_free(command); 1881 mr_free(boot_device); 1882 mr_free(tmp); 1883 mr_free(editor); 2012 1884 return (res); 2013 1885 } … … 2129 2001 paranoid_fclose(fout); 2130 2002 paranoid_fclose(fin); 2131 paranoid_free(incoming);2003 mr_free(incoming); 2132 2004 } 2133 2005 … … 2177 2049 } 2178 2050 close_progress_form(); 2179 paranoid_free(tmp);2051 mr_free(tmp); 2180 2052 } 2181 2053 … … 2222 2094 assert(p_external_copy_of_mountlist != NULL); 2223 2095 2224 mountlist = m alloc(sizeof(struct mountlist_itself));2096 mountlist = mr_malloc(sizeof(struct mountlist_itself)); 2225 2097 memcpy((void *) mountlist, (void *) p_external_copy_of_mountlist, 2226 2098 sizeof(struct mountlist_itself)); … … 2306 2178 log_to_screen("All partitions were unmounted OK."); 2307 2179 } 2308 free(mountlist);2309 paranoid_free(command);2310 paranoid_free(tmp);2180 mr_free(mountlist); 2181 mr_free(command); 2182 mr_free(tmp); 2311 2183 return (retval); 2312 2184 } … … 2346 2218 res = 0; 2347 2219 } 2348 paranoid_free(command);2220 mr_free(command); 2349 2221 return (res); 2350 2222 } … … 2610 2482 run_program_and_log_output(command, FALSE); 2611 2483 g_backup_media_type = bkpinfo->backup_media_type; 2612 paranoid_free(device);2613 paranoid_free(command);2614 paranoid_free(tmp);2615 paranoid_free(cfg_file);2616 paranoid_free(mounted_cfgf_path);2617 paranoid_free(mountpt);2618 paranoid_free(ramdisk_fname);2619 paranoid_free(mountlist_file);2484 mr_free(device); 2485 mr_free(command); 2486 mr_free(tmp); 2487 mr_free(cfg_file); 2488 mr_free(mounted_cfgf_path); 2489 mr_free(mountpt); 2490 mr_free(ramdisk_fname); 2491 mr_free(mountlist_file); 2620 2492 return (retval); 2621 2493 } … … 2649 2521 2650 2522 malloc_string(screen_message); 2651 raidlist = m alloc(sizeof(struct raidlist_itself));2523 raidlist = mr_malloc(sizeof(struct raidlist_itself)); 2652 2524 2653 2525 assert(wait_for_percentage <= 100); … … 2684 2556 } 2685 2557 } 2686 paranoid_free(screen_message);2687 paranoid_free(raidlist);2688 } 2558 mr_free(screen_message); 2559 mr_free(raidlist); 2560 }
Note:
See TracChangeset
for help on using the changeset viewer.