Changeset 3193 in MondoRescue for branches/3.1/mondo
- Timestamp:
- Sep 29, 2013, 9:31:34 AM (11 years ago)
- Location:
- branches/3.1/mondo/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/mondo/src/include/mr_str.h
r2421 r3193 16 16 17 17 extern char *mr_strtok(char *instr, const char *delims, int *lastpos); 18 extern char *mr_stresc(char *instr, char *toesc, const char escchr );19 extern char *mr_date(void);18 extern char *mr_stresc(char *instr, char *toesc, const char escchr, const char specialchr); 19 extern inline char *mr_date(void); 20 20 extern void mr_strip_spaces(char *in_out); 21 21 extern void mr_strip_char(char *in_out, char *caracs); -
branches/3.1/mondo/src/include/my-stuff.h
r3147 r3193 339 339 #define ARCH_THREADS 2 ///< The number of simultaneous threads running afio in the background. 340 340 #define ARCH_BUFFER_NUM (ARCH_THREADS*4) // Number of permissible queued afio files 341 #define FORTY_SPACES " " ///< 40 spaces. 341 342 #define DO_MBR_PLEASE "/tmp/DO-MBR-PLEASE" 342 343 #define MONDO_MNTLISTCHG "/tmp/mountlist.changed" -
branches/3.1/mondo/src/lib/mr_str.c
r3147 r3193 12 12 13 13 #include "mr_mem.h" 14 15 // to get bool type 16 #define _MY_STUFF_H_ 17 #include "my-stuff.h" 14 18 15 19 /** … … 66 70 * @note this function allocates memory that needs to be freed by caller 67 71 **/ 68 char *mr_stresc(char *instr, char *toesc, const char escchr ) {72 char *mr_stresc(char *instr, char *toesc, const char escchr, const char specialchr) { 69 73 char *inptr = NULL; 70 74 char *retstr = NULL; … … 72 76 char *escptr = NULL; 73 77 int cnt = 0; 78 bool found = FALSE; 74 79 75 80 inptr = instr; 76 77 81 // Count how many characters need escaping. 78 82 while (*inptr != '\0') { … … 82 86 // Found it, skip the rest. 83 87 cnt++; 88 // if specialchar (' or ") then replace it with '\'' or "\"" so adds 2 chars 89 if (*inptr == specialchr) { 90 cnt += 2; 91 } 84 92 break; 85 93 } … … 88 96 inptr++; 89 97 } 98 90 99 inptr = instr; 91 92 100 retstr = (char *) mr_malloc(strlen(inptr) + cnt + 1); 93 101 retptr = retstr; … … 99 107 if (*inptr == *escptr) { 100 108 // Found it, skip the rest. 101 *retptr = escchr; 102 retptr++; 109 // if specialchar (' or ") then replace it with '\'' or "\"" so adds 2 chars 110 if (*inptr == specialchr) { 111 *retptr = specialchr; 112 retptr++; 113 *retptr = escchr; 114 retptr++; 115 found = TRUE; 116 } else { 117 *retptr = escchr; 118 retptr++; 119 } 103 120 break; 104 121 } … … 108 125 retptr++; 109 126 inptr++; 127 if (found) { 128 // finish to put the remaining specialchr 129 *retptr = specialchr; 130 retptr++; 131 found = FALSE; 132 } 110 133 } 111 134 *retptr = '\0'; … … 114 137 } 115 138 116 /** 117 * Remove all characters in caracs from begining and end of string @p in_out 118 * @param in_out The string to strip char characters from (modified). 139 /* Return a string containing the date */ 140 char *mr_date(void) { 141 142 time_t tcurr; 143 144 tcurr = time(NULL); 145 return(ctime(&tcurr)); 146 } 147 148 /* Return an allocated string containing the date 149 char *mr_date(void) { 150 151 time_t tcurr; 152 char *tmp = NULL; 153 154 tcurr = time(NULL); 155 mr_asprintf(tmp, "%s", ctime(&tcurr)); 156 mr_chomp(tmp); 157 return(tmp); 158 } 119 159 */ 120 void mr_strip_char(char *in_out, char *caracs) {121 int i = 0;122 int j = 0;123 int length = 0;124 125 if (caracs == NULL) {126 return;127 }128 if (in_out == NULL) {129 return;130 }131 length = (int)strlen(in_out);132 133 /* Skip initial caracs */134 for (i = 0; index(caracs, in_out[i]) != NULL && i < length ; i++);135 136 /* Shift the string to the begining if needed */137 if (i != 0) {138 for (j = 0; i < length ; i++, j++) {139 in_out[j] = in_out[i];140 }141 /* Erase the end of the string if needed */142 j++;143 in_out[j] = '\0';144 }145 146 /* Skip final spaces and special chars */147 for (i = (int)strlen(in_out) - 1; i >= 0 && index(caracs, in_out[i]) != NULL; i--);148 149 /* The string now ends after that char */150 i++;151 in_out[i] = '\0';152 }153 160 154 161 /** … … 158 165 */ 159 166 void mr_strip_spaces(char *in_out) { 160 161 int i; 162 char *tmp = NULL; 163 164 mr_asprintf(tmp, ""); 165 166 /* Build the string of char to avoid: ctrl char up to space*/ 167 for (i = 0; i <= ' '; i++) { 168 mr_strcat(tmp, "%c", i); 169 } 170 171 mr_strip_char(in_out, tmp); 172 mr_free(tmp); 173 } 167 int i = 0; 168 int j = 0; 169 size_t length; 170 171 if (in_out == NULL) { 172 return; 173 } 174 length = strlen(in_out); 175 176 /* Skip initial spaces and special chars */ 177 for (i = 0; in_out[i] <= ' ' && i < (int)length ; i++); 178 /* Shift the string to the begining if needed */ 179 if (i != 0) { 180 for (j = 0; i < (int)length ; i++, j++) { 181 in_out[j] = in_out[i]; 182 } 183 /* Erase the end of the string if needed */ 184 j++; 185 in_out[j] = '\0'; 186 } 187 188 /* Skip final spaces and special chars */ 189 for (i = (int)strlen(in_out) - 1; i >= 0 && in_out[i] <= ' '; i--); 190 191 /* The string now ends after that char */ 192 i++; 193 in_out[i] = '\0'; 194 } 195 174 196 175 197 /* 176 198 * Remove '\n' char from both sides of @p in_out. 177 199 * @param in_out The string to strip characters from (modified). 178 */ 200 179 201 void mr_chomp(char *in_out) { 180 202 181 203 mr_strip_char(in_out, "\n"); 182 204 } 183 184 /* Return an allocated string containing the date */ 185 char *mr_date(void) { 186 187 time_t tcurr; 188 char *tmp = NULL; 189 190 tcurr = time(NULL); 191 mr_asprintf(tmp, "%s", ctime(&tcurr)); 192 mr_chomp(tmp); 193 return(tmp); 194 } 195 196 205 */ 206 207 /** 208 * Remove all characters in caracs from begining and end of string @p in_out 209 * @param in_out The string to strip char characters from (modified). 210 211 void mr_strip_char(char *in_out, char *caracs) { 212 int i = 0; 213 int j = 0; 214 size_t length = 0; 215 216 if (caracs == NULL) { 217 return; 218 } 219 if (in_out == NULL) { 220 return; 221 } 222 length = strlen(in_out); 223 224 /* Skip initial caracs */ 225 for (i = 0; index(caracs, in_out[i]) != NULL && i < (int)length ; i++); 226 227 /* Shift the string to the begining if needed */ 228 if (i != 0) { 229 for (j = 0; i < (int)length ; i++, j++) { 230 in_out[j] = in_out[i]; 231 } 232 /* Erase the end of the string if needed */ 233 j++; 234 in_out[j] = '\0'; 235 } 236 237 /* Skip final caracs */ 238 for (i = (int)strlen(in_out) - 1; i >= 0 && index(caracs, in_out[i]) != NULL; i--); 239 240 /* The string now ends after that char */ 241 i++; 242 in_out[i] = '\0'; 243 } 244 */ 245 -
branches/3.1/mondo/src/mondoarchive/mondoarchive.c
r3148 r3193 37 37 extern t_bkptype g_backup_media_type; 38 38 extern int g_loglevel; 39 39 40 extern char *g_magicdev_command; 40 41 … … 101 102 log_msg(7, "Seven..."); 102 103 log_msg(8, "Eight..."); 104 printf("See %s for details of backup run.\n", MONDO_LOGFILE); 103 105 } 104 106 … … 164 166 FILE *fin = NULL; 165 167 168 /* Make sure I'm root; abort if not */ 169 if (getuid() != 0) { 170 fprintf(stderr, "Please run as root.\r\n"); 171 exit(127); 172 } 173 174 /* If -V, -v or --version then echo version no. and quit */ 175 if (argc == 2 && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V") || !strcmp(argv[argc - 1], "--version"))) { 176 printf("mondoarchive v%s\nSee man page for help\n", PACKAGE_VERSION); 177 exit(0); 178 } 179 180 /* Initialize variables */ 181 166 182 printf("Initializing...\n"); 183 184 init_bkpinfo(); 185 186 /* Memory allocation is done in those functions */ 187 malloc_libmondo_global_strings(); 167 188 168 189 /* initialize log file with time stamp */ 169 190 unlink(MONDO_LOGFILE); 170 tmp = mr_date(); 171 log_msg(0, "Time started: %s", tmp); 172 mr_free(tmp); 173 174 init_bkpinfo(); 175 176 /* Memory allocation is done in those functions */ 177 malloc_libmondo_global_strings(); 191 log_msg(0, "Time started: %s", mr_date()); 192 178 193 if (argc == 1) { 179 194 g_text_mode = FALSE; … … 188 203 } 189 204 setup_newt_stuff(); 190 191 /* Make sure I'm root; abort if not */192 if (getuid() != 0) {193 fatal_error("Please run as root.\n");194 }195 196 /* If -V, -v or --version then echo version no. and quit */197 if (argc == 2 && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V") || !strcmp(argv[argc - 1], "--version"))) {198 printf("mondoarchive v%s\nSee man page for help\n", PACKAGE_VERSION);199 finish(0);200 }201 202 205 203 206 /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */ … … 449 452 450 453 /* finalize log file with time stamp */ 451 tmp = mr_date(); 452 log_msg(0, "Time finished: %s", tmp); 453 mr_free(tmp); 454 log_msg(0, "Time finished: %s", mr_date()); 454 455 455 456 if (chdir("/tmp")) { -
branches/3.1/mondo/src/mondorestore/mondo-prep.c
r3161 r3193 43 43 extern char *MONDO_LOGFILE; 44 44 45 // FIXME: is it really usefull - maps to /tmp/prep.sh ?? 45 46 FILE *g_fprep = NULL; 46 47 extern char *g_mondo_cfg_file; // where m*ndo-restore.cfg (the config file) is stored … … 108 109 sync(); 109 110 sync(); 110 popup_and_OK 111 ("I must now reboot. Please leave the boot media in the drive and repeat your actions - e.g. type 'nuke' - and it should work fine."); 111 popup_and_OK("I must now reboot. Please leave the boot media in the drive and repeat your actions - e.g. type 'nuke' - and it should work fine."); 112 112 paranoid_system("reboot"); 113 113 } 114 114 } 115 // Still here? Cool!115 // Still here? Cool! 116 116 log_msg(1, "Cool. I didn't have to wipe anything."); 117 117 } … … 218 218 } 219 219 220 // TODO: FIXME 220 221 command = malloc(1024); 221 222 … … 390 391 } 391 392 mr_asprintf(tmp1, "echo \"%s\" >> /tmp/out.sh", command); 392 if (system(tmp1)) { 393 //FIXME 394 } 393 paranoid_system(tmp1); 395 394 mr_free(tmp1); 396 395 sleep(1); … … 515 514 } 516 515 } 517 paranoid_free(incoming);518 516 519 517 return (0); … … 539 537 char *level = NULL; 540 538 char *program = NULL; 541 char *strtmp = NULL;542 539 char *oldmd = NULL; 543 540 544 // leave straight away if raidlist is initial or has no entries 545 if (!raidlist || raidlist->entries == 0) { 546 log_msg(1, "No RAID arrays found."); 547 return 1; 548 } else { 549 log_msg(1, "%d RAID arrays found.", raidlist->entries); 550 } 551 // find raidlist entry for requested device 552 for (i = 0; i < raidlist->entries; i++) { 553 if (!strcmp(raidlist->el[i].raid_device, device)) break; 554 } 555 // check whether RAID device was found in raidlist 556 if (i == raidlist->entries) { 557 log_msg(1, "RAID device %s not found in list.", device); 558 return 1; 559 } 560 // create device list from normal disks followed by spare ones 561 mr_asprintf(devices, "%s", raidlist->el[i].data_disks.el[0].device); 562 for (j = 1; j < raidlist->el[i].data_disks.entries; j++) { 563 mr_asprintf(strtmp, "%s", devices); 564 mr_free(devices); 565 mr_asprintf(devices, "%s %s", strtmp, raidlist->el[i].data_disks.el[j].device); 566 mr_free(strtmp); 567 } 568 for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) { 569 mr_asprintf(strtmp, "%s", devices); 570 mr_free(devices); 571 mr_asprintf(devices, "%s %s", strtmp, raidlist->el[i].spare_disks.el[j].device); 572 mr_free(strtmp); 573 } 574 // translate RAID level 575 if (raidlist->el[i].raid_level == -2) { 576 mr_asprintf(level, "multipath"); 577 } else if (raidlist->el[i].raid_level == -1) { 578 mr_asprintf(level, "linear"); 579 } else { 580 mr_asprintf(level, "raid%d", raidlist->el[i].raid_level); 581 } 582 // create RAID device: 583 // - RAID device, number of devices and devices mandatory 584 // - parity algorithm, chunk size and spare devices optional 585 // - faulty devices ignored 586 // - persistent superblock always used as this is recommended 587 588 mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d %s", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries, oldmd); 589 mr_free(oldmd); 590 if (raidlist->el[i].parity != -1) { 591 mr_asprintf(strtmp, "%s", program); 592 mr_free(program); 593 switch(raidlist->el[i].parity) { 594 case 0: 595 mr_asprintf(program, "%s --parity=%s", strtmp, "la"); 596 break; 597 case 1: 598 mr_asprintf(program, "%s --parity=%s", strtmp, "ra"); 599 break; 600 case 2: 601 mr_asprintf(program, "%s --parity=%s", strtmp, "ls"); 602 break; 603 case 3: 604 mr_asprintf(program, "%s --parity=%s", strtmp, "rs"); 605 break; 606 default: 607 fatal_error("Unknown RAID parity algorithm."); 608 break; 609 } 610 mr_free(strtmp); 611 } 612 if (raidlist->el[i].chunk_size != -1) { 613 mr_asprintf(strtmp, "%s", program); 614 mr_free(program); 615 mr_asprintf(program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size); 616 mr_free(strtmp); 617 } 618 if (raidlist->el[i].spare_disks.entries > 0) { 619 mr_asprintf(strtmp, "%s", program); 620 mr_free(program); 621 mr_asprintf(program, "%s --spare-devices=%d", strtmp, raidlist->el[i].spare_disks.entries); 622 mr_free(strtmp); 623 } 624 mr_asprintf(strtmp, "%s", program); 625 mr_free(program); 626 mr_asprintf(program, "%s %s", strtmp, devices); 627 mr_free(strtmp); 628 res = run_program_and_log_output(program, 1); 629 mr_free(devices); 630 mr_free(level); 631 mr_free(program); 632 return res; 541 // leave straight away if raidlist is initial or has no entries 542 if (!raidlist || raidlist->entries == 0) { 543 log_msg(1, "No RAID arrays found."); 544 return 1; 545 } else { 546 log_msg(1, "%d RAID arrays found.", raidlist->entries); 547 } 548 // find raidlist entry for requested device 549 for (i = 0; i < raidlist->entries; i++) { 550 if (!strcmp(raidlist->el[i].raid_device, device)) break; 551 } 552 // check whether RAID device was found in raidlist 553 if (i == raidlist->entries) { 554 log_msg(1, "RAID device %s not found in list.", device); 555 return 1; 556 } else { 557 log_msg(1, "RAID device %s found in list (%d).", device, i); 558 } 559 560 // create device list from normal disks followed by spare ones 561 if (raidlist->el[i].data_disks.el[0].device != NULL) { 562 mr_asprintf(devices, "%s", raidlist->el[i].data_disks.el[0].device); 563 log_msg(4, "Adding device %s to list", raidlist->el[i].data_disks.el[0].device); 564 } else { 565 log_msg(1, "Strange, there are entries but no device"); 566 } 567 for (j = 1; j < raidlist->el[i].data_disks.entries; j++) { 568 mr_strcat(devices, " %s", raidlist->el[i].data_disks.el[j].device); 569 log_msg(4, "Adding device %s to list", raidlist->el[i].data_disks.el[j].device); 570 } 571 for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) { 572 mr_strcat(devices, " %s", raidlist->el[i].spare_disks.el[j].device); 573 log_msg(4, "Adding spare device %s to list", raidlist->el[i].spare_disks.el[j].device); 574 } 575 log_msg(4, "RAID devices: %s", devices); 576 // translate RAID level 577 if (raidlist->el[i].raid_level == -2) { 578 mr_asprintf(level, "multipath"); 579 } else if (raidlist->el[i].raid_level == -1) { 580 mr_asprintf(level, "linear"); 581 } else { 582 mr_asprintf(level, "raid%d", raidlist->el[i].raid_level); 583 } 584 // create RAID device: 585 // - RAID device, number of devices and devices mandatory 586 // - parity algorithm, chunk size and spare devices optional 587 // - faulty devices ignored 588 // - persistent superblock always used as this is recommended 589 590 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); 591 mr_free(level); 592 log_msg(4, "cmd built: %s", program); 593 // Restoring the UUID and Version stored at backup time of present 594 for (v = 0; v < raidlist->el[i].additional_vars.entries ; v++ ) { 595 log_msg(4,"Working on additional param #%d (Label: %s)",v,raidlist->el[i].additional_vars.el[v].label); 596 if ((raidlist->el[i].additional_vars.el[v].label != NULL) && (strcmp(raidlist->el[i].additional_vars.el[v].label,"UUID") == 0)) { 597 // We have a UUID to handle 598 if (raidlist->el[i].additional_vars.el[v].value != NULL) { 599 // force its restoration in order to avoid modifying all conf files using it 600 log_it("Managing previous UUID %s", raidlist->el[i].additional_vars.el[v].value); 601 mr_strcat(program, " --uuid %s",raidlist->el[i].additional_vars.el[v].value); 602 continue; 603 } else { 604 log_msg(1,"Unable to manage previous NULL UUID"); 605 } 606 } 607 if ((raidlist->el[i].additional_vars.el[v].label != NULL) && (strcmp(raidlist->el[i].additional_vars.el[v].label,"Version") == 0)) { 608 // We have a Version to handle 609 if (raidlist->el[i].additional_vars.el[v].value != NULL) { 610 // force its restoration in order to support all complex boot loader + md format cases 611 // Also see bug #473 612 log_it("Managing previous Version %s", raidlist->el[i].additional_vars.el[v].value); 613 mr_strcat(program, " -e %s",raidlist->el[i].additional_vars.el[v].value); 614 continue; 615 } else { 616 log_msg(1,"Unable to manage previous NULL Version"); 617 } 618 } 619 } 620 log_msg(4, "cmd built: %s", program); 621 if (raidlist->el[i].parity != -1) { 622 switch(raidlist->el[i].parity) { 623 case 0: 624 mr_strcat(program, " --parity=%s", "la"); 625 break; 626 case 1: 627 mr_strcat(program, " --parity=%s", "ra"); 628 break; 629 case 2: 630 mr_strcat(program, " --parity=%s", "ls"); 631 break; 632 case 3: 633 mr_strcat(program, " --parity=%s", "rs"); 634 break; 635 default: 636 fatal_error("Unknown RAID parity algorithm."); 637 break; 638 } 639 } 640 log_msg(4, "cmd built: %s", program); 641 if (raidlist->el[i].chunk_size != -1) { 642 mr_strcat(program, " --chunk=%d", raidlist->el[i].chunk_size); 643 } 644 if (raidlist->el[i].spare_disks.entries > 0) { 645 mr_strcat(program, " --spare-devices=%d", raidlist->el[i].spare_disks.entries); 646 } 647 log_msg(4, "cmd built: %s", program); 648 mr_strcat(program, " %s", devices); 649 log_msg(2, "RAID device re-created with the following command:\n%s\n", program); 650 if (test == TRUE) { 651 res = run_program_and_log_output(program, 1); 652 } else { 653 // test mode, always returns TRUE without executing the mdadm command 654 res = TRUE; 655 } 656 // free memory 657 mr_free(devices); 658 mr_free(program); 659 return res; 633 660 } 634 661 … … 759 786 sync(); 760 787 sleep(1); 788 if (g_fprep) { 789 fprintf(g_fprep, "%s\n", program); 790 } 761 791 762 792 log_msg(1, "Making %s", device); … … 845 875 return (retval); 846 876 } 847 848 849 850 877 851 878 … … 1006 1033 if (g_partition_table_locked_up > 0) { 1007 1034 if (retval > 0 && !interactively) { 1008 //123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234567891035 //123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 1009 1036 log_to_screen("Partition table locked up %d times. At least one 'mkfs' (format) command", g_partition_table_locked_up); 1010 1037 log_to_screen("failed. I think these two events are related. Sometimes, fdisk's ioctl() call"); … … 1015 1042 sync(); 1016 1043 sync(); 1017 if (system("reboot")) { 1018 // FIXME 1019 } 1044 paranoid_system("reboot"); 1020 1045 } 1021 1046 } else { … … 1558 1583 1559 1584 if (pout_to_fdisk) { 1560 // mark relevant partition as bootable1561 tmp1 = call_program_and_get_last_line_of_output ("make-me-bootable "MINDI_CACHE"/mountlist.txt dummy",TRUE);1562 mr_asprintf(tmp, "a\n%s\n", tmp1);1563 mr_free(tmp1);1564 1565 fput_string_one_char_at_a_time(pout_to_fdisk, tmp);1566 mr_free(tmp);1567 1568 1585 // close fdisk 1586 fput_string_one_char_at_a_time(pout_to_fdisk, "p\n"); 1569 1587 fput_string_one_char_at_a_time(pout_to_fdisk, "w\n"); 1570 sync();1571 1588 paranoid_pclose(pout_to_fdisk); 1572 1589 sync(); 1573 1590 log_msg(0,"------------------- fdisk.log looks like this ------------------"); 1574 1591 mr_asprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE); 1575 if (system(tmp)) { 1576 // FIXME 1577 } 1592 paranoid_system(tmp); 1578 1593 mr_free(tmp); 1579 1594 1580 log_msg(0, 1581 "------------------- end of fdisk.log... word! ------------------"); 1595 // mark relevant partition as bootable 1596 mr_asprintf(tmp1,"make-me-bootable /tmp/mountlist.txt %s",drivename); 1597 call_program_and_get_last_line_of_output(tmp1); 1598 mr_free(tmp1); 1599 log_msg(0,"------------------- end of fdisk.log... ------------------"); 1600 sync(); 1601 1582 1602 mr_asprintf(tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG); 1583 1603 if (!run_program_and_log_output(tmp, 5)) { … … 1947 1967 #endif 1948 1968 } 1949 log_msg(1, tmp,"Setting %s's type to %s (%s)", partition, format, partcode);1969 log_msg(1, "Setting %s's type to %s (%s)", partition, format, partcode); 1950 1970 mr_free(partition); 1951 1971 … … 2009 2029 } 2010 2030 } 2011 2012 2031 mr_free(partcode); 2032 2013 2033 return (res); 2014 2034 } … … 2080 2100 mr_asprintf(program, "vinum stop -f %s", raid_device); 2081 2101 #else 2082 2083 2102 // use raidstop if it exists, otherwise use mdadm 2103 if (run_program_and_log_output("which raidstop", FALSE)) { 2084 2104 mr_asprintf(program, "mdadm -S %s", raid_device); 2085 2105 } else { … … 2201 2221 * @return 0 for success, nonzero for failure. 2202 2222 */ 2203 char *which_format_command_do_i_need(char *format)2223 static char *which_format_command_do_i_need(char *format) 2204 2224 { 2205 2225 /** buffers *********************************************************/ … … 2229 2249 } else if (strcmp(format, "ext4") == 0) { 2230 2250 mr_asprintf(program, "mkfs -t ext4 -F -q"); 2231 } else if (strcmp(format, "btrfs") == 0) {2232 strcpy(program, "mkfs.btrfs");2233 2251 } else if (strcmp(format, "btrfs") == 0) { 2234 2252 strcpy(program, "mkfs.btrfs"); -
branches/3.1/mondo/src/mondorestore/mondo-rstr-compare.c
r3161 r3193 76 76 paranoid_fclose(fin); 77 77 78 79 mr_asprintf(bigfile_fname, "%s", biggiestruct.filename); 80 log_msg(2, "biggiestruct.filename = %s", biggiestruct.filename); 78 81 mr_asprintf(checksum, "%s", biggiestruct.checksum); 79 mr_asprintf(bigfile_fname, "%s", biggiestruct.filename);80 81 log_msg(2, "biggiestruct.filename = %s", biggiestruct.filename);82 82 log_msg(2, "biggiestruct.checksum = %s", biggiestruct.checksum); 83 83 … … 85 85 mr_asprintf(tmp, "Comparing %s", bigfile_fname); 86 86 newtDrawRootText(0, 22, tmp); 87 paranoid_free(tmp);87 mr_free(tmp); 88 88 newtRefresh(); 89 89 } 90 if ( !checksum[0]) {90 if (checksum == NULL]) { 91 91 log_msg(2, "Warning - %s has no checksum", bigfile_fname); 92 92 } 93 93 if (!strncmp(bigfile_fname, "/dev/", 5)) { 94 94 log_msg(2, "IGNORING %s as begining with /dev", bigfile_fname); 95 mr_free(checksum); 95 96 mr_free(bigfile_fname); 96 97 return (1); … … 104 105 mr_asprintf(tmp, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE); 105 106 paranoid_system(tmp); 106 paranoid_free(tmp);107 mr_free(tmp); 107 108 108 109 if (i) { 109 110 log_OS_error("Warning - command failed"); 111 mr_free(checksum); 112 mr_free(bigfile_fname); 110 113 return (1); 111 114 } else { 112 115 if (!(fin = fopen("/tmp/md5sum.txt", "r"))) { 113 log_msg(2, 114 "Unable to open /tmp/md5sum.txt; can't get live checksum");116 log_msg(2, "Unable to open /tmp/md5sum.txt; can't get live checksum"); 117 mr_free(checksum); 115 118 mr_free(bigfile_fname); 116 119 return (1); … … 135 138 136 139 log_msg(1, tmp); 137 paranoid_free(tmp);140 mr_free(tmp); 138 141 139 142 if (retval) { … … 270 273 } else { 271 274 // afio 275 mr_asprintf(tmp, "%s", compressor_exe); 272 276 mr_free(compressor_exe); 273 mr_asprintf(tmp, "%s", compressor_exe);274 277 mr_asprintf(compressor_exe, "-P %s -Z", tmp); 275 278 mr_free(tmp); … … 291 294 } 292 295 mr_free(compressor_exe); 293 paranoid_free(archiver_exe);296 mr_free(archiver_exe); 294 297 295 298 #undef BUFSIZE … … 474 477 noof_changed_files = count_lines_in_file(MONDO_CACHE"/changed.txt"); 475 478 if (noof_changed_files) { 476 mr_asprintf(tmp, "%ld files do not match the backup ", noof_changed_files); 477 log_to_screen(tmp); 478 mr_free(tmp); 479 log_to_screen("%ld files do not match the backup ", noof_changed_files); 479 480 480 481 mr_asprintf(command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE); … … 525 526 526 527 /************************************************************************** 527 * also deletes tmp/filelist.full & biggielist.txt _and_ tries to *528 * also deletes tmp/filelist.full & tmp/biggielist.txt _and_ tries to * 528 529 * restore them from start of tape, if available * 529 530 **************************************************************************/ … … 653 654 } 654 655 655 mvaddstr_and_log_it(g_currentY, 656 0, "Verifying archives against filesystem"); 656 mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem"); 657 657 658 658 mr_free(bkpinfo->media_device); … … 711 711 } 712 712 713 mvaddstr_and_log_it(g_currentY, 714 0, "Verifying archives against filesystem"); 713 mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem"); 715 714 res = verify_tape_backups(); 716 715 if (chdir(dir)) { -
branches/3.1/mondo/src/mondorestore/mondo-rstr-newt.c
r3161 r3193 212 212 mr_strip_spaces(size_str); 213 213 214 strip_spaces(device_str);214 mr_strip_spaces(device_str); 215 215 if (b_res == bOK) { 216 216 if (device_str[strlen(device_str) - 1] == '/') { … … 480 480 mr_free(tmp); 481 481 mr_free(prompt); 482 mr_free(prompt);483 482 return; 484 483 } … … 530 529 531 530 assert(raidrec != NULL); 532 533 if (system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null")) { 534 // FIXME 535 } 531 paranoid_system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null"); 536 532 personalities = last_line_of_file("/tmp/raid-personalities.txt"); 537 533 mr_asprintf(prompt, "Please enter the RAID level you want. %s", personalities); … … 583 579 mr_free(tmp); 584 580 mr_free(prompt); 581 585 582 raidrec->raid_level = out; 586 583 #endif … … 607 604 int pos = 0; 608 605 609 /** buffers ***********************************************************/610 606 assert(mountlist != NULL); 611 607 assert(raidlist != NULL); … … 931 927 strcpy(g_strings_of_flist_window[i - 1], tmp1); 932 928 mr_free(tmp1); 929 933 930 dummybool = g_is_path_selected[i]; 934 931 g_is_path_selected[i] = g_is_path_selected[i - 1]; … … 1683 1680 1684 1681 /** buffers ***********************************************************/ 1685 char title_of_editraidForm_window[MAX_STR_LEN];1682 char *title_of_editraidForm_window = NULL; 1686 1683 1687 1684 /** newt **************************************************************/ … … 1713 1710 memcpy((void *) &bkp_raidrec, (void *) raidrec, 1714 1711 sizeof(struct vinum_plex)); 1715 sprintf(title_of_editraidForm_window, "%s.p%i", 1716 raidlist->el[currline].volname, currline2); 1712 mr_asprintf(title_of_editraidForm_window, "%s.p%i", raidlist->el[currline].volname, currline2); 1717 1713 newtPushHelpLine 1718 1714 (" Please select a subdisk to edit, or edit this plex's parameters"); 1719 1715 newtOpenWindow(13, 3, 54, 18, title_of_editraidForm_window); 1716 mr_free(title_of_editraidForm_window); 1717 1720 1718 for (;;) { 1721 1719 int i; … … 1888 1886 strcpy(raidrec->additional_vars.el[lino].value, p); 1889 1887 } 1888 mr_free(header); 1889 mr_free(comment); 1890 1890 mr_free(p); 1891 1891 } … … 1953 1953 mr_asprintf(tmp, "%-24s %-24s %-8s %s", "Device", "Mountpoint", "Format", "Size (MB)"); 1954 1954 headerMsg = newtLabel(2, 1, tmp); 1955 mr_free(tmp); 1956 1955 1957 flawsLabelA = newtLabel(2, 13, " "); 1956 1958 flawsLabelB = newtLabel(2, 14, " "); … … 2044 2046 } 2045 2047 newtFormDestroy(myForm); 2046 2047 mr_free(flaws_str_A);2048 mr_free(flaws_str_B);2049 mr_free(flaws_str_C);2050 mr_free(tmp);2051 2052 2048 newtPopWindow(); 2053 2049 newtPopHelpLine(); … … 2829 2825 disklist->el[currline].index = atoi(sz_res); 2830 2826 } 2827 2831 2828 redraw_disklist(disklist, keylist, partitionsListbox); 2832 2829 mr_free(sz_res); -
branches/3.1/mondo/src/mondorestore/mondo-rstr-tools.c
r3161 r3193 90 90 fatal_error("Cannot openin outfname"); 91 91 } 92 for (mr_getline(incoming, fin); !feof(fin) ; mr_getline(incoming, fin)) {92 for (mr_getline(incoming, fin); !feof(fin) && (incoming != NULL); mr_getline(incoming, fin)) { 93 93 mr_strip_spaces(incoming); 94 94 … … 140 140 } 141 141 if (file[0] == '/' && file[1] == '/') { 142 mr_asprintf(tmp, "%s", file); 143 mr_free(file); 142 tmp = file; 144 143 145 144 mr_asprintf(file, "%s", tmp + 1); … … 174 173 * @return 0 for success, nonzero for failure. 175 174 */ 176 int iso_fiddly_bits(bool nuke_me_please) 177 { 178 179 180 181 182 175 int iso_fiddly_bits(bool nuke_me_please) { 176 177 char *mount_isodir_command = NULL; 178 char *command = NULL; 179 char *mds = NULL; 180 int retval = 0, i; 181 char *isodir_format = NULL; 183 182 184 183 g_ISO_restore_mode = TRUE; … … 305 304 mr_strcat(additional_parameters, "-o ro"); 306 305 } 306 mr_free(tmp); 307 307 308 tmp = find_home_of_exe("setfattr"); 308 309 if (tmp) { … … 374 375 mr_free(mountpoint); 375 376 376 377 return (res); 377 378 } 378 379 /************************************************************************** … … 418 419 mr_free(tmp); 419 420 res = mount_device(mountlist->el[lino].device, mountlist->el[lino].mountpoint, mountlist->el[lino].format, writeable); 420 421 421 retval += res; 422 422 if (res) { … … 660 660 assert(bkpinfo != NULL); 661 661 assert(cfgf != NULL); 662 log_it("Entering read_cfg_file_into_bkpinfo"); 662 663 663 664 media_specified_by_user = bkpinfo->backup_media_type; // or 'none', if not specified … … 676 677 bkpinfo->please_dont_eject = TRUE; 677 678 } else if (!strcmp(value, "iso")) { 678 // Patch by Conor Daly - 2004/07/12679 679 bkpinfo->backup_media_type = iso; 680 680 if (am_I_in_disaster_recovery_mode()) { … … 687 687 bkpinfo->backup_media_type = cdr; 688 688 run_program_and_log_output("umount -d "MNT_CDROM, 1); 689 log_it 690 ("Re-jigging configuration AGAIN. CD-R, not ISO."); 689 log_it("Re-jigging configuration AGAIN. CD-R, not ISO."); 691 690 } 692 691 } … … 698 697 mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX); 699 698 } 699 log_it("Setting Prefix to %s", bkpinfo->prefix); 700 700 } else if ((!strcmp(value, "netfs")) || (!strcmp(value, "nfs"))) { 701 701 /* Stay compatible with previous versions by allowing nfs as an entry here */ … … 727 727 tmp = call_program_and_get_last_line_of_output("cat " CMDLINE,TRUE); 728 728 if (strstr(tmp, "pxe")) { 729 /* We need to override prefix value in PXE mode as it's 729 /* We need to override prefix value in PXE mode as it's 730 730 * already done in start-netfs */ 731 731 envtmp1 = getenv("imgname"); … … 754 754 mr_free(bkpinfo->media_device); 755 755 mr_asprintf(bkpinfo->media_device, "/dev/cdrom"); 756 bkpinfo->media_size[0] = 1999 * 1024; 757 bkpinfo->media_size[1] = 650; /* good guess */ 756 bkpinfo->media_size = 650; /* good guess */ 758 757 } else if (bkpinfo->backup_media_type == usb) { 759 758 envtmp1 = getenv("MRUSBDEV"); … … 778 777 value = read_cfg_var(cfg_file, "media-size"); 779 778 if (value != NULL) { 780 bkpinfo->media_size [1]= atol(value);779 bkpinfo->media_size = atol(value); 781 780 mr_free(value); 782 781 } else { 783 bkpinfo->media_size [1]= 0L;782 bkpinfo->media_size = 0L; 784 783 } 785 784 log_msg(2, "Backup medium is TAPE --- dev=%s", bkpinfo->media_device); … … 787 786 mr_free(bkpinfo->media_device); 788 787 mr_asprintf(bkpinfo->media_device, "/dev/cdrom"); /* we don't really need this var */ 789 bkpinfo->media_size[0] = 1999 * 1024; /* 650, probably, but we don't need this var anyway */ 790 bkpinfo->media_size[1] = 1999 * 1024; /* 650, probably, but we don't need this var anyway */ 791 log_msg(2, "Backup medium is CD-R[W]"); 788 bkpinfo->media_size = 1999 * 1024; /* 650, probably, but we don't need this var anyway */ 789 log_msg(2, "Backup medium is similar to CD-R[W]"); 792 790 } 793 791 } else { … … 968 966 mr_free(tmp1); 969 967 } 970 971 968 } else if (bkpinfo->backup_media_type == iso) { 972 969 /* Patch by Conor Daly 23-june-2004 … … 1044 1041 if (! bkpinfo->disaster_recovery) { 1045 1042 if (bkpinfo->backup_media_type != media_specified_by_user) { 1046 log_msg(2, 1047 "bkpinfo->backup_media_type != media_specified_by_user, so I'd better ask :)"); 1043 log_msg(2, "bkpinfo->backup_media_type != media_specified_by_user, so I'd better ask :)"); 1048 1044 interactively_obtain_media_parameters_from_user(FALSE); 1049 1045 media_specified_by_user = bkpinfo->backup_media_type; … … 1086 1082 int res = 0; 1087 1083 pid_t pid; 1084 bool extract_mountlist_stub = FALSE; 1088 1085 1089 1086 assert(bkpinfo != NULL); … … 1234 1231 popup_and_OK("You'll now be chrooted under your future / partition.\nEdit /etc/mkinitcpio.conf if needed and rebuild your initrd with the kernel preset name e.g.\nmkinitcpio -p kernel26\nThen type exit to finish.\n"); 1235 1232 } else { 1236 popup_and_OK("You'll now be chrooted under your future / partition.\nGo under /boot and rebuild your init rd with\nmkinitrd -f -v initrd-2.x.y.img 2.x.y e.g.\nThen type exit to finish.");1233 popup_and_OK("You'll now be chrooted under your future / partition.\nGo under /boot and rebuild your init(rd|ramfs) with\nmkinitrd -f -v initrd-2.x.y.img 2.x.y e.g.\nor initramfs, dracut, ... Then type exit to finish."); 1237 1234 } 1238 1235 mvaddstr_and_log_it(g_currentY, 0, "Modifying initrd..."); … … 1435 1432 1436 1433 if ((res) || (mntlistchg)) { 1437 popup_and_OK("GRUB installation failed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1438 } else { 1439 popup_and_OK("The mountlist was changed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1440 } 1441 if (!g_text_mode) { 1442 newtSuspend(); 1443 } 1444 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1445 paranoid_system(tmp); 1446 mr_free(tmp); 1447 1448 mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1449 paranoid_system(tmp); 1450 mr_free(tmp); 1451 1452 if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) { 1453 mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1454 } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) { 1455 mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor); 1456 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/grub.cfg")) { 1457 mr_asprintf(tmp, "chroot %s %s /boot/grub2/grub.cfg", MNT_RESTORING, editor); 1458 } 1459 paranoid_system(tmp); 1460 mr_free(tmp); 1461 1462 if (does_file_exist(MNT_RESTORING"/boot/grub/device.map")) { 1434 if (res) { 1435 popup_and_OK("GRUB installation failed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1436 } else { 1437 popup_and_OK("The mountlist was changed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install"); 1438 } 1439 if (!g_text_mode) { 1440 newtSuspend(); 1441 } 1442 mr_asprintf(editor, "%s", find_my_editor()); 1443 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1444 paranoid_system(tmp); 1445 mr_free(tmp); 1446 1447 mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1448 paranoid_system(tmp); 1449 mr_free(tmp); 1450 1451 if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) { 1452 mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1453 } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) { 1454 mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor); 1455 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/grub.cfg")) { 1456 mr_asprintf(tmp, "chroot %s %s /boot/grub2/grub.cfg", MNT_RESTORING, editor); 1457 } 1458 paranoid_system(tmp); 1459 mr_free(tmp); 1460 1461 if (does_file_exist(MNT_RESTORING"/boot/grub/device.map")) { 1462 mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1463 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/device.map")) { 1464 mr_asprintf(tmp, "chroot %s %s /boot/grub2/device.map", MNT_RESTORING, editor); 1465 } 1466 paranoid_system(tmp); 1467 mr_free(tmp); 1468 1469 if (!g_text_mode) { 1470 newtResume(); 1471 } 1472 mr_asprintf(command, "stabgrub-me %s", boot_device); 1473 res = run_program_and_log_output(command, 1); 1474 mr_free(command); 1475 1476 if (res) { 1477 popup_and_OK("GRUB installation failed. Please fix the conf files so that a manual install using 'grub-install' or similar command works. You are now chroot()'ed to your restored system. Please type 'exit' when you are done."); 1478 newtSuspend(); 1479 paranoid_system("chroot " MNT_RESTORING); 1480 newtResume(); 1481 popup_and_OK("Thank you."); 1482 } else { 1483 popup_and_OK("GRUB is now installed correctly"); 1484 done = TRUE; 1485 } 1486 popup_and_OK("You will now edit fstab, mtab, device.map and menu.lst/grub.cfg"); 1487 if (!g_text_mode) { 1488 newtSuspend(); 1489 } 1490 1491 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1492 paranoid_system(tmp); 1493 mr_free(tmp); 1494 1495 mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1496 paranoid_system(tmp); 1497 mr_free(tmp); 1498 1499 if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) { 1500 mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1501 } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) { 1502 mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor); 1503 } 1504 paranoid_system(tmp); 1505 mr_free(tmp); 1506 1463 1507 mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1464 } else if (does_file_exist(MNT_RESTORING"/boot/grub2/device.map")) { 1465 mr_asprintf(tmp, "chroot %s %s /boot/grub2/device.map", MNT_RESTORING, editor); 1466 } 1467 paranoid_system(tmp); 1468 mr_free(tmp); 1469 1470 if (!g_text_mode) { 1471 newtResume(); 1472 } 1473 mr_asprintf(command, "stabgrub-me %s", boot_device); 1474 res = run_program_and_log_output(command, 1); 1475 mr_free(command); 1476 if (res) { 1477 popup_and_OK("GRUB installation failed. Please fix the conf files so that a manual install using 'grub-install' or similar command works. You are now chroot()'ed to your restored system. Please type 'exit' when you are done."); 1478 newtSuspend(); 1479 paranoid_system("chroot " MNT_RESTORING); 1480 newtResume(); 1481 popup_and_OK("Thank you."); 1482 } else { 1483 popup_and_OK("GRUB is now installed correctly"); 1484 done = TRUE; 1485 } 1486 popup_and_OK("You will now edit fstab, mtab, device.map and menu.lst/grub.cfg"); 1487 if (!g_text_mode) { 1488 newtSuspend(); 1489 } 1490 mr_asprintf(editor, "%s", find_my_editor()); 1491 1492 mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor); 1493 paranoid_system(tmp); 1494 mr_free(tmp); 1495 1496 mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor); 1497 paranoid_system(tmp); 1498 mr_free(tmp); 1499 1500 if (does_file_exist(MNT_RESTORING"/boot/grub/menu.lst")) { 1501 mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor); 1502 } else if (does_file_exist(MNT_RESTORING"/boot/grub/grub.cfg")) { 1503 mr_asprintf(tmp, "chroot %s %s /boot/grub/grub.cfg", MNT_RESTORING, editor); 1504 } 1505 paranoid_system(tmp); 1506 mr_free(tmp); 1507 1508 mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor); 1509 paranoid_system(tmp); 1510 mr_free(tmp); 1511 mr_free(editor); 1512 1513 if (!g_text_mode) { 1514 newtResume(); 1508 paranoid_system(tmp); 1509 mr_free(tmp); 1510 mr_free(editor); 1511 1512 if (!g_text_mode) { 1513 newtResume(); 1514 } 1515 1515 } 1516 1516 } … … 1525 1525 log_msg(1, "WARNING - grub-MR not found; using grub-install"); 1526 1526 } 1527 mvaddstr_and_log_it(g_currentY, 1528 0, 1529 "Running GRUB... "); 1527 mvaddstr_and_log_it(g_currentY, 0, "Running GRUB... "); 1530 1528 log_it("%s",command); 1531 1529 res = run_program_and_log_output(command, 1); … … 1611 1609 paranoid_system(tmp); 1612 1610 mr_free(tmp); 1613 1614 1611 mr_free(editor); 1615 1612 … … 1688 1685 paranoid_system(tmp); 1689 1686 mr_free(tmp); 1690 1691 1687 mr_free(editor); 1692 1688 … … 2114 2110 paranoid_free(raidlist); 2115 2111 } 2116 2117 -
branches/3.1/mondo/src/mondorestore/mondoprep.h
r3147 r3193 69 69 int partition_everything(struct mountlist_itself *); 70 70 int do_my_funky_lvm_stuff(bool, bool); 71 char *which_format_command_do_i_need(char *);72 71 int make_dummy_partitions(FILE *, char *, int); 73 72 int make_list_of_drives(struct mountlist_itself *, -
branches/3.1/mondo/src/mondorestore/mondorestore.c
r3161 r3193 582 582 log_msg(1, "Restoring subset"); 583 583 retval += restore_everything(filelist); 584 free_filelist(filelist); 584 585 } else { 585 586 mr_free(bkpinfo->restore_path); … … 839 840 "Using tune2fs/tune4fs to identify your ext2,3,4 partitions"); 840 841 841 mr_asprintf(tmp , "label-partitions-as-necessary %s < /tmp/fstab >> %s 2>> %s", MINDI_CACHE"/mountlist.txt", MONDO_LOGFILE, MONDO_LOGFILE);842 mr_asprintf(tmp1, "label-partitions-as-necessary %s < /tmp/fstab >> %s 2>> %s", MINDI_CACHE"/mountlist.txt", MONDO_LOGFILE, MONDO_LOGFILE); 842 843 res = run_program_and_log_output(tmp, TRUE); 843 mr_free(tmp );844 mr_free(tmp1); 844 845 if (res) { 845 846 log_to_screen("label-partitions-as-necessary returned an error"); … … 2045 2046 int res; 2046 2047 int attempts; 2047 long current_tarball_number = 0 ;2048 long current_tarball_number = 0L; 2048 2049 long max_val; 2049 2050 /**malloc ***/ … … 2620 2621 mr_free(tmp1); 2621 2622 2623 mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself)); 2624 raidlist = (struct raidlist_itself *)mr_malloc(sizeof(struct raidlist_itself)); 2625 2626 2627 2622 2628 /* Init GUI */ 2623 2629 setup_newt_stuff(); /* call newtInit and setup screen log */ … … 2666 2672 2667 2673 log_it("what time is it"); 2668 2669 mountlist = (struct mountlist_itself *)mr_malloc(sizeof(struct mountlist_itself));2670 raidlist = (struct raidlist_itself *)mr_malloc(sizeof(struct raidlist_itself));2671 2674 2672 2675 /* Process command-line parameters */ … … 2799 2802 mount_boot_if_necessary(); /* for Gentoo users */ 2800 2803 log_msg(2, "Still here."); 2801 /* Adding an initialisation in order to avoid to h ndle NULL pointer later */2804 /* Adding an initialisation in order to avoid to handle NULL pointer later */ 2802 2805 mr_free(bkpinfo->restore_path); 2803 2806 mr_asprintf(bkpinfo->restore_path, "%s", "/tmp");
Note:
See TracChangeset
for help on using the changeset viewer.