- Timestamp:
- Mar 12, 2024, 3:10:24 AM (2 months ago)
- Location:
- branches/3.3/mondo/src
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/common/libmondo-archive.c
r3891 r3892 1446 1446 * @param ntfsprog_fifo The FIFO to ntfsclone if this is an imagedev, NULL otherwise. 1447 1447 * @param biggie_file_number The sequence number of this biggie file (starting from 0). 1448 * @param noof_biggie_files The number of biggie files there are total.1449 1448 * @return The number of errors encountered (0 for success) 1450 1449 * @see make_slices_and_images 1451 1450 * @ingroup LLarchiveGroup 1452 1451 */ 1453 int slice_up_file_etc(char *biggie_filename, char *ntfsprog_fifo, long biggie_file_number, long noof_biggie_files,bool use_ntfsprog) {1452 int slice_up_file_etc(char *biggie_filename, char *ntfsprog_fifo, long biggie_file_number, bool use_ntfsprog) { 1454 1453 1455 1454 /*@ buffers ************************************************** */ … … 1812 1811 write_header_block_to_stream(biggie_fsize, bigfile_fname, use_ntfsprog ? BLK_START_A_PIHBIGGIE : BLK_START_A_NORMBIGGIE); 1813 1812 } 1814 res = slice_up_file_etc(bigfile_fname, ntfsprog_fifo, biggie_file_number, noof_biggie_files,use_ntfsprog);1813 res = slice_up_file_etc(bigfile_fname, ntfsprog_fifo, biggie_file_number, use_ntfsprog); 1815 1814 1816 1815 /* Free it here as ntfsprog_fifo is not used anymore */ … … 2417 2416 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2418 2417 write_header_block_to_stream((off_t)0, "start-of-afioballs", BLK_START_AFIOBALLS); 2418 #ifdef __FreeBSD__ 2419 2419 #if __FreeBSD__ == 5 2420 2420 log_msg(1, "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0"); 2421 2421 res = make_afioballs_and_images_OLD(); 2422 #endif 2422 2423 #else 2423 2424 res = make_afioballs_and_images_OLD(); … … 2643 2644 mr_asprintf(broken_bios_sz, "yes"); /* assume so */ 2644 2645 2645 if ( pkpinfo->auto_recovery) {2646 if (bkpinfo->auto_recovery) { 2646 2647 mr_asprintf(cd_recovery_sz, "yes"); 2647 2648 } else { -
branches/3.3/mondo/src/common/libmondo-cli.c
r3890 r3892 998 998 void termination_in_progress(int sig) 999 999 { 1000 log_msg(1, "Termination in progress ");1000 log_msg(1, "Termination in progress by signal %d",sig); 1001 1001 usleep(1000); 1002 1002 pthread_exit(0); -
branches/3.3/mondo/src/common/libmondo-devices.c
r3889 r3892 443 443 mr_free(mount_list); 444 444 445 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");445 mr_asprintf(command, "%s", "cat " MDSTAT_FILE " |grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 446 446 log_msg (5, "Running: %s", command); 447 447 mount_list = call_program_and_get_last_line_of_output(command); … … 499 499 500 500 /* Get the Software raid device list */ 501 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");501 mr_asprintf(command, "%s", "cat " MDSTAT_FILE " | grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 502 502 log_msg (5, " Running: %s", command); 503 503 mount_list = call_program_and_get_last_line_of_output(command); … … 788 788 bool does_nonMS_partition_exist(void) 789 789 { 790 #if __FreeBSD__790 #ifdef __FreeBSD__ 791 791 return 792 792 !system("for drive in /dev/ad? /dev/da?; do fdisk $drive | grep -q FreeBSD && exit 0; done; false"); … … 2136 2136 2137 2137 case udev: 2138 if (!ask_me_yes_or_no 2139 ("This option is for advanced users only. Are you sure?")) { 2138 if (!ask_me_yes_or_no("This option is for advanced users only. Are you sure?")) { 2140 2139 log_to_screen("User has chosen not to backup the machine"); 2141 2140 finish(1); 2142 2141 } 2142 break; 2143 2143 2144 case tape: 2144 2145 … … 2483 2484 // NTFS 2484 2485 tmp = call_program_and_get_last_line_of_output("mr-parted2fdisk -l 2>/dev/null | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"); 2485 strncpy(tmp1, tmp,(MAX_STR_LEN / 4)-1); 2486 if (strlen(tmp) > 2) { 2487 tmp1 = mr_popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp); 2488 if (tmp1 == NULL) { 2489 log_to_screen("User has chosen not to backup the machine"); 2490 mr_free(tmp); 2491 mr_free(tmp1); 2492 finish(1); 2493 } 2494 mr_free(bkpinfo->image_devs); 2495 bkpinfo->image_devs = tmp1; 2496 } 2486 2497 mr_free(tmp); 2487 if (strlen(tmp1) > 2) {2488 if (!popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp1,(MAX_STR_LEN / 4)-1)) {2489 log_to_screen("User has chosen not to backup the machine");2490 finish(1);2491 }2492 mr_asprintf(bkpinfo->image_devs, "%s", tmp1);2493 }2494 2498 2495 2499 if (bkpinfo->exclude_paths != NULL ) { … … 2572 2576 mr_free(compression_type); 2573 2577 2578 #ifdef __FreeBSD__ 2574 2579 #if __FreeBSD__ == 5 2575 2580 mr_asprintf(bkpinfo->kernel_path, "%s", "/boot/kernel/kernel"); 2576 2581 #elif __FreeBSD__ == 4 2577 2582 mr_asprintf(bkpinfo->kernel_path, "%s", "/kernel"); 2583 #endif 2578 2584 #elif linux 2579 2585 if (figure_out_kernel_path_interactively_if_necessary(bkpinfo->kernel_path)) { -
branches/3.3/mondo/src/common/libmondo-filelist.c
r3879 r3892 1482 1482 /** 1483 1483 * Create the filelist for the backup. It will be stored in [scratchdir]/archives/filelist.full. 1484 * @param logfile Unused.1485 1484 * @param tmpdir The tmpdir of the backup. 1486 1485 * @param scratchdir The scratchdir of the backup. … … 1490 1489 * @param userdef_filelist The user-defined filelist, or NULL if you're using @p include_paths. 1491 1490 * @return 0, always. 1492 * @bug @p logfile is unused.1493 1491 * @bug Return value is meaningless. 1494 1492 */ 1495 int mondo_makefilelist(char * logfile, char *tmpdir, char *scratchdir,1493 int mondo_makefilelist(char *tmpdir, char *scratchdir, 1496 1494 char *include_paths, char *excp, int differential, 1497 1495 char *userdef_filelist) … … 1657 1655 1658 1656 if (bkpinfo->make_filelist) { 1659 res = mondo_makefilelist( MONDO_LOGFILE,bkpinfo->tmpdir, bkpinfo->scratchdir, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL);1657 res = mondo_makefilelist(bkpinfo->tmpdir, bkpinfo->scratchdir, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL); 1660 1658 } else { 1661 res = mondo_makefilelist( MONDO_LOGFILE,bkpinfo->tmpdir, bkpinfo->scratchdir, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths);1659 res = mondo_makefilelist(bkpinfo->tmpdir, bkpinfo->scratchdir, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths); 1662 1660 } 1663 1661 -
branches/3.3/mondo/src/common/libmondo-raid.c
r3879 r3892 56 56 mr_strcat(command, "raid%d", raidno); 57 57 } 58 mr_strcat(command, "\" /proc/mdstat> /dev/null 2> /dev/null");58 mr_strcat(command, "\" " MDSTAT_FILE " > /dev/null 2> /dev/null"); 59 59 log_it("Is raid %d registered? Command = '%s'", raidno, command); 60 60 res = system(command); -
branches/3.3/mondo/src/common/libmondo-stream.c
r3882 r3892 317 317 { 318 318 int res = 0; 319 char *command = NULL;320 319 321 320 if (bkpinfo->media_device == NULL) { -
branches/3.3/mondo/src/common/libmondo-string.c
r3882 r3892 387 387 switch (i) { 388 388 case 0: 389 mr_asprintf(output, " zero");389 mr_asprintf(output, "%s", "zero"); 390 390 break; 391 391 case 1: 392 mr_asprintf(output, " one");392 mr_asprintf(output, "%s", "one"); 393 393 break; 394 394 case 2: 395 mr_asprintf(output, " two");395 mr_asprintf(output, "%s", "two"); 396 396 break; 397 397 case 3: 398 mr_asprintf(output, " three");398 mr_asprintf(output, "%s", "three"); 399 399 break; 400 400 case 4: 401 mr_asprintf(output, " four");401 mr_asprintf(output, "%s", "four"); 402 402 break; 403 403 case 5: 404 mr_asprintf(output, " five");404 mr_asprintf(output, "%s", "five"); 405 405 break; 406 406 case 6: 407 mr_asprintf(output, " six");407 mr_asprintf(output, "%s", "six"); 408 408 break; 409 409 case 7: 410 mr_asprintf(output, " seven");410 mr_asprintf(output, "%s", "seven"); 411 411 break; 412 412 case 8: 413 mr_asprintf(output, " eight");413 mr_asprintf(output, "%s", "eight"); 414 414 break; 415 415 case 9: 416 mr_asprintf(output, "nine"); 416 mr_asprintf(output, "%s", "nine"); 417 break; 417 418 case 10: 418 mr_asprintf(output, "ten"); 419 mr_asprintf(output, "%s", "ten"); 420 break; 419 421 default: 420 422 mr_asprintf(output, "%d", i); 423 break; 421 424 } 422 425 return (output); -
branches/3.3/mondo/src/common/libmondo-tools.c
r3890 r3892 735 735 736 736 if (!run_program_and_log_output("mr-parted2fdisk -l 2>/dev/null | grep -i raid", 1) && !does_file_exist("/etc/raidtab")) { 737 log_to_screen("You have RAID partitions but no /etc/raidtab - creating one from /proc/mdstat");737 log_to_screen("You have RAID partitions but no /etc/raidtab - creating one from " MDSTAT_FILE); 738 738 create_raidtab_from_mdstat(MDSTAT_FILE,"/etc/raidtab"); 739 739 } -
branches/3.3/mondo/src/common/libmondo-verify.c
r3878 r3892 345 345 * @param bkpinfo The backup information structure. @c bkpinfo->tmpdir is the only field used. 346 346 * @param biggie_fname The filename of the biggiefile to verify. 347 * @param size The size in bytes of said biggiefile. 347 * @param size The size in bytes of said biggiefile. TODO: Removed as not used. Is it linked to slice_siz ? 348 348 * @return 0 for success (even if the file doesn't match); nonzero for a tape error. 349 349 */ 350 350 int 351 verify_a_biggiefile_from_stream(char *biggie_fname , long long size)351 verify_a_biggiefile_from_stream(char *biggie_fname) 352 352 { 353 353 … … 609 609 if (bkpinfo->restore_path != NULL) { 610 610 mr_asprintf(logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname); 611 res = verify_a_biggiefile_from_stream(logical_fname , size);611 res = verify_a_biggiefile_from_stream(logical_fname); 612 612 mr_free(logical_fname); 613 613 retval += res; -
branches/3.3/mondo/src/common/newt-specific.c
r3882 r3892 79 79 long g_isoform_starttime; ///< The time (in seconds since the epoch) that the evalcall form was opened. 80 80 int g_isoform_old_progress = -1; ///< The most recent progress update of the evalcall form (percent). 81 char g_isoform_header_str = NULL; ///< The string for the evalcall form title.81 char *g_isoform_header_str = NULL; ///< The string for the evalcall form title. 82 82 int g_mysterious_dot_counter; ///< The counter for the twirling baton (/ | \\ - ...) on percentage less than 3 83 83 int g_noof_log_lines = 6; ///< The number of lines to show in the log at the bottom of the screen. … … 602 602 603 603 assert(ttl != NULL); 604 //strcpy(g_isoform_header_str, ttl);605 604 if (g_text_mode) { 606 605 log_msg(0, ttl); … … 614 613 g_isoform_starttime = get_time(); 615 614 if (g_text_mode) { 616 log_msg(0, g_isoform_header_str);615 log_msg(0, "g_isoform_header_str = %s", g_isoform_header_str); 617 616 } else { 618 617 g_isoform_header = newtLabel(1, 1, g_isoform_header_str); … … 1012 1011 } 1013 1012 1014 /* not sure it's useful to shrink here1015 prompt = malloc(MAX_NEWT_COMMENT_LEN);1016 strncpy(prompt, p, MAX_NEWT_COMMENT_LEN - 1);1017 prompt[MAX_NEWT_COMMENT_LEN - 1] = '\0';1018 text = newtTextboxReflowed(1, 1, prompt, 40, 5, 5, 0);1019 */1020 1013 text = newtTextboxReflowed(1, 1, p, 40, 5, 5, 0); 1021 1014 b_1 = newtButton(20 - ((button2[0] != '\0') ? strlen(button1) + 2 : strlen(button1) / 2), newtTextboxGetNumLines(text) + 3, button1); … … 1528 1521 * @param flentry The filelist entry to stringify. 1529 1522 * @return The string form of @p flentry. 1530 * @note The returned value points to static storage that will be overwritten with each call.1523 * @note The returned value points to a dynamically allocated string that the caller needs to free. 1531 1524 */ 1532 1525 char *filelist_entry_to_string(struct s_filelist_entry *flentry) { 1533 static char comment[100]; 1534 char *tmp = NULL; 1526 char *comment = NULL; 1535 1527 1536 1528 log_msg(8, "entering"); 1537 1529 assert(flentry != NULL); 1538 1530 if (flentry->severity == 0) { 1539 mr_asprintf( tmp, "0 ");1531 mr_asprintf(comment, "0 "); 1540 1532 } else if (flentry->severity == 1) { 1541 mr_asprintf( tmp, "low ");1533 mr_asprintf(comment, "low "); 1542 1534 } else if (flentry->severity == 2) { 1543 mr_asprintf(tmp, "med "); 1544 } else { 1545 mr_asprintf(tmp, "high"); 1546 } 1547 mr_strcat(tmp, " "); 1548 mr_strcat(tmp, flentry->filename); 1549 strncpy(comment, tmp, 99); 1550 mr_free(tmp); 1551 1535 mr_asprintf(comment, "med "); 1536 } else { 1537 mr_asprintf(comment, "high"); 1538 } 1539 mr_strcat(comment, " "); 1540 mr_strcat(comment, flentry->filename); 1552 1541 log_it("leaving"); 1553 1542 return (comment); … … 1615 1604 for (i = 0; i < filelist->entries; i++) { 1616 1605 keylist[i] = (void *) i; 1606 tmp = filelist_entry_to_string(&(filelist->el[i])); 1617 1607 newtListboxAppendEntry(fileListbox, 1618 filelist_entry_to_string(& 1619 (filelist-> 1620 el[i])), 1608 tmp, 1621 1609 keylist[i]); 1610 mr_free(tmp); 1622 1611 } 1623 1612 mr_asprintf(differ_sz, " %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", i); -
branches/3.3/mondo/src/include/mr_str.h
r3708 r3892 20 20 extern char *mr_strip_spaces(const char *instr); 21 21 extern char *mr_str_substitute(const char *in, const char *token, const char *subst); 22 23 // All safe strncpy calls are prefixed 24 #define mr_strncpy strncpy 22 25 /* 23 26 extern void mr_strip_char(char *in_out, char *caracs); -
branches/3.3/mondo/src/lib/mr_str.c
r3794 r3892 12 12 13 13 #include "mr_mem.h" 14 #include "mr_str.h" 14 15 15 16 // to get bool type … … 52 53 pos1 = strcspn(strptr, delims); 53 54 token = (char *)mr_malloc(sizeof(*token) * (pos1 + 1)); 54 strncpy(token, strptr, pos1);55 mr_strncpy(token, strptr, pos1); 55 56 token[pos1] = '\0'; 56 57 *lastpos = *lastpos + pos1 + pos2 + 1; -
branches/3.3/mondo/src/mondoarchive/mondoarchive.c
r3885 r3892 276 276 } 277 277 278 if (argc > 2 && !strcmp(argv[1], "find- cd")) {278 if (argc > 2 && !strcmp(argv[1], "find-optical")) { 279 279 g_loglevel = 10; 280 280 setup_newt_stuff(); … … 283 283 } else { 284 284 printf("Optical drive is at %s\n", tmp); 285 }286 mr_free(tmp);287 finish(0);288 }289 290 if (argc > 2 && !strcmp(argv[1], "find-dvd")) {291 g_loglevel = 10;292 setup_newt_stuff();293 if (tmp = find_optical_device()) {294 printf("Failed to find DVD drive\n");295 } else {296 printf("DVD is at %s\n", tmp);297 285 } 298 286 mr_free(tmp); -
branches/3.3/mondo/src/mondorestore/mondo-prep.c
r3885 r3892 1026 1026 } 1027 1027 #else 1028 fin = fopen( "/proc/mdstat", "r");1028 fin = fopen(MDSTAT_FILE, "r"); 1029 1029 if (!fin) { 1030 log_OS_error( "/proc/mdstat");1030 log_OS_error(MDSTAT_FILE); 1031 1031 paranoid_free(incoming); 1032 1032 return (1); … … 1127 1127 log_msg(1, "Creating LVMs"); 1128 1128 if (does_file_exist("/tmp/i-want-my-lvm")) { 1129 wait_until_software_raids_are_prepped( "/proc/mdstat",100);1129 wait_until_software_raids_are_prepped(100); 1130 1130 log_to_screen("Configuring LVM"); 1131 1131 if (!g_text_mode) { … … 1899 1899 log_it("Partitioning drive %s", drivename); 1900 1900 1901 #if __FreeBSD__1901 #ifdef __FreeBSD__ 1902 1902 log_it("(Not opening fdisk now; that's the Linux guy's job)"); 1903 1903 pout_to_fdisk = NULL; … … 1920 1920 if (lino < 0) { 1921 1921 // device not found in mountlist 1922 #if __FreeBSD__1922 #ifdef __FreeBSD__ 1923 1923 // If this is the first partition (just as a sentinel value), 1924 1924 // then see if the user has picked 'dangerously-dedicated' mode. … … 1986 1986 1987 1987 log_it("Wiping %s's partition table", drivename); 1988 #if __FreeBSD__1988 #ifdef __FreeBSD__ 1989 1989 // FreeBSD doesn't let you write to blk devices in <512byte chunks. 1990 1990 file = open(drivename, O_WRONLY); -
branches/3.3/mondo/src/mondorestore/mondo-rstr-newt.c
r3879 r3892 615 615 * @ingroup restoreGuiMountlist 616 616 */ 617 void 618 choose_raid_level(struct OSSWAP (raid_device_record, vinum_plex) * raidrec) 619 { 617 void choose_raid_level(struct OSSWAP (raid_device_record, vinum_plex) * raidrec) { 620 618 621 619 #ifdef __FreeBSD__ 622 620 623 621 /** int ***************************************************************/ 624 int res = 0;625 622 int out = 0; 626 623 627 624 /** buffers ***********************************************************/ 628 char tmp[MAX_STR_LEN]; 625 char *tmp = NULL; 626 char *tmp1 = NULL; 629 627 char *prompt = NULL; 630 char sz[MAX_STR_LEN];628 char *sz = NULL; 631 629 632 630 mr_asprintf(prompt, "Please enter the RAID level you want. (concat, striped, raid5)"); 633 631 if (raidrec->raidlevel == -1) { 634 strcpy(tmp, "concat");632 mr_asprintf(tmp, "%s", "concat"); 635 633 } else if (raidrec->raidlevel == 0) { 636 strcpy(tmp, "striped");634 mr_asprintf(tmp, "%s", "striped"); 637 635 } else { 638 sprintf(tmp, "raid%i", raidrec->raidlevel);636 mr_asprintf(tmp, "raid%i", raidrec->raidlevel); 639 637 } 640 638 for (out = 999; out == 999;) { 641 res = popup_and_get_string("Specify RAID level", prompt, tmp, 10);642 if ( !res) {639 tmp1 = mr_popup_and_get_string("Specify RAID level", prompt, tmp); 640 if (tmp1 == NULL) { 643 641 mr_free(prompt); 642 mr_free(tmp); 644 643 return; 645 644 } 646 strip_spaces(tmp); 645 mr_free(tmp); 646 tmp = mr_strip_spaces(tmp1); 647 log_it(tmp); 648 647 649 if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') { 648 strcpy(sz, tmp); 649 strncpy(tmp, sz + 1, strlen(sz) - 2); 650 sz = tmp; 651 // safe as shorter 652 mr_strncpy(tmp, sz + 1, strlen(sz) - 2); 650 653 tmp[strlen(sz) - 2] = '\0'; 651 654 } … … 657 660 out = 5; 658 661 } 659 log_it(tmp); 662 mr_free(tmp); 663 660 664 if (is_this_raid_personality_registered(out)) { 661 665 log_it("Groovy. You've picked a RAID personality which is registered."); … … 664 668 { 665 669 out = 999; 670 if (raidrec->raid_level == -1) { 671 mr_asprintf(tmp, "%s", "linear"); 672 } else { 673 mr_asprintf(tmp, "%d", raidrec->raid_level); 674 } 666 675 } 667 676 } 668 677 } 669 678 mr_free(prompt); 679 mr_free(tmp); 670 680 671 681 raidrec->raidlevel = out; 672 682 #else 673 683 /** buffers ***********************************************************/ 674 char tmp[MAX_STR_LEN]; 684 char *tmp = NULL; 685 char *tmp1 = NULL; 675 686 char *personalities = NULL; 676 687 char *prompt = NULL; 677 char sz[MAX_STR_LEN];688 char *sz; 678 689 int out = 0; 679 int res = 0;680 690 681 691 682 692 assert(raidrec != NULL); 683 paranoid_system("grep Pers /proc/mdstat> /tmp/raid-personalities.txt 2> /dev/null");693 paranoid_system("grep Pers " MDSTAT_FILE " > /tmp/raid-personalities.txt 2> /dev/null"); 684 694 mr_asprintf(personalities, "%s", last_line_of_file("/tmp/raid-personalities.txt")); 685 695 mr_asprintf(prompt, "Please enter the RAID level you want. %s", personalities); … … 687 697 688 698 if (raidrec->raid_level == -1) { 689 strcpy(tmp, "linear");699 mr_asprintf(tmp, "%s", "linear"); 690 700 } else { 691 sprintf(tmp, "%d", raidrec->raid_level);701 mr_asprintf(tmp, "%d", raidrec->raid_level); 692 702 } 693 703 for (out = 999; 694 704 out != -1 && out != 0 && out != 1 && out != 4 && out != 5 695 705 && out != 10;) { 696 res = popup_and_get_string("Specify RAID level", prompt, tmp, 10); 697 if (!res) { 706 tmp1 = mr_popup_and_get_string("Specify RAID level", prompt, tmp); 707 if (tmp1 == NULL) { 708 mr_free(tmp); 709 mr_free(prompt); 698 710 return; 699 711 } 700 strip_spaces(tmp); 712 mr_free(tmp); 713 tmp = mr_strip_spaces(tmp1); 714 log_it(tmp); 715 701 716 if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') { 702 strcpy(sz, tmp); 703 strncpy(tmp, sz + 1, strlen(sz) - 2); 717 sz = tmp; 718 // safe as shorter 719 mr_strncpy(tmp, sz + 1, strlen(sz) - 2); 704 720 tmp[strlen(sz) - 2] = '\0'; 705 721 } … … 711 727 out = atoi(tmp); 712 728 } 713 log_it(tmp); 729 mr_free(tmp); 730 714 731 if (is_this_raid_personality_registered(out)) { 715 732 log_it("Groovy. You've picked a RAID personality which is registered."); … … 717 734 if (ask_me_yes_or_no("You have chosen a RAID personality which is not registered with the kernel. Make another selection?")) { 718 735 out = 999; 736 mr_free(tmp); 737 if (raidrec->raid_level == -1) { 738 mr_asprintf(tmp, "%s", "linear"); 739 } else { 740 mr_asprintf(tmp, "%d", raidrec->raid_level); 741 } 719 742 } 720 743 } 721 744 } 722 745 mr_free(prompt); 746 mr_free(tmp); 723 747 724 748 raidrec->raid_level = out; … … 2483 2507 2484 2508 2485 #if __FreeBSD__2509 #ifdef __FreeBSD__ 2486 2510 /** 2487 2511 * Add a subdisk to @p raidrec. -
branches/3.3/mondo/src/mondorestore/mondo-rstr-tools-EXT.h
r3885 r3892 29 29 extern void ask_about_these_imagedevs(char *infname, char *outfname); 30 30 31 extern void wait_until_software_raids_are_prepped(char *mdstat_file, 32 int wait_for_percentage); 31 extern void wait_until_software_raids_are_prepped(int wait_for_percentage); -
branches/3.3/mondo/src/mondorestore/mondo-rstr-tools.c
r3889 r3892 22 22 // no include for now in mondo-rstr-newt.c 23 23 extern int edit_filelist(struct s_node *); 24 25 extern struct s_bkpinfo *bkpinfo; 24 26 25 27 /** … … 90 92 extern char *MONDO_LOGFILE; 91 93 92 /* Reference to global bkpinfo */93 extern struct s_bkpinfo *bkpinfo;94 95 94 /* Should we use or not extended attributes and acl when restoring */ 96 95 extern char *g_getfattr; … … 525 524 * @return TRUE if OK was pressed, FALSE otherwise. 526 525 */ 527 bool get_isodir_info(char *isodir_device, char *isodir_format, 528 struct s_bkpinfo *bkpinfo, bool nuke_me_please) 526 bool get_isodir_info(char *isodir_device, char *isodir_format, bool nuke_me_please) 529 527 { 530 528 … … 610 608 } 611 609 612 if (!get_isodir_info(g_isodir_device, g_isodir_format, bkpinfo,nuke_me_please)) {610 if (!get_isodir_info(g_isodir_device, g_isodir_format, nuke_me_please)) { 613 611 return (1); 614 612 } … … 678 676 /** malloc **/ 679 677 char *tmp = NULL; 680 char *tmp1 = NULL;681 678 char *command = NULL; 682 679 char *mountdir = NULL; … … 2258 2255 /* @} - end restoreUtilityGroup */ 2259 2256 2260 void wait_until_software_raids_are_prepped( char *mdstat_file,int wait_for_percentage)2257 void wait_until_software_raids_are_prepped(int wait_for_percentage) 2261 2258 { 2262 2259 struct raidlist_itself *raidlist; -
branches/3.3/mondo/src/mondorestore/mondorestore.c
r3885 r3892 32 32 #include "newt-specific-EXT.h" 33 33 34 extern void wait_until_software_raids_are_prepped(char *, int);35 34 extern void twenty_seconds_til_yikes(void); 36 35 // in mondo-prep.c … … 377 376 case -1: 378 377 fatal_error("Fork failure"); 378 break; 379 379 case 0: 380 380 log_msg(3, "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)", biggiestruct.filename, ntfsprog_fifo); … … 1041 1041 * @param orig_bf_fname The original filename of the biggiefile. 1042 1042 * @param biggiefile_number The number of the biggiefile (starting from 0). 1043 * @param orig_checksum Unused.1044 * @param biggiefile_size Unused.1045 1043 * @param filelist The node structure containing the list of files to be restored. 1046 1044 * If @p orig_bf_fname is not in the list, it will be ignored. 1047 1045 * @return 0 for success (or skip), nonzero for failure. 1048 * @bug orig_checksum and biggiefile_size are unused (except to check that they are non-NULL). 1049 */ 1050 int restore_a_biggiefile_from_stream(char *orig_bf_fname, long biggiefile_number, char *orig_checksum, //UNUSED 1051 long long biggiefile_size, //UNUSED 1046 */ 1047 int restore_a_biggiefile_from_stream(char *orig_bf_fname, long biggiefile_number, 1052 1048 struct s_node *filelist, 1053 1049 int use_ntfsprog, … … 1085 1081 assert(bkpinfo != NULL); 1086 1082 assert(orig_bf_fname != NULL); 1087 assert(orig_checksum != NULL);1088 1083 1089 1084 pathname_of_last_file_restored[0] = '\0'; … … 1144 1139 case -1: 1145 1140 fatal_error("Fork failure"); 1141 break; 1146 1142 case 0: 1147 1143 log_msg(3, "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)", outfile_fname, ntfsprog_fifo); … … 1372 1368 res = restore_a_biggiefile_from_stream(biggie_fname, 1373 1369 current_bigfile_number, 1374 biggie_cksum,1375 biggie_size,1376 1370 filelist, ctrl_chr, 1377 1371 pathname_of_last_biggie_restored); … … 2730 2724 } 2731 2725 2732 if (argc == 3&& strcmp(argv[1], "--mdstat") == 0) {2733 wait_until_software_raids_are_prepped( argv[2],100);2726 if (argc == 2 && strcmp(argv[1], "--mdstat") == 0) { 2727 wait_until_software_raids_are_prepped(100); 2734 2728 finish(0); 2735 2729 } … … 2952 2946 } 2953 2947 2954 /*2955 log_to_screen("If you are REALLY in a hurry, hit Ctrl-Alt-Del now.");2956 log_to_screen("Otherwise, please wait until the RAID disks are done.");2957 wait_until_software_raids_are_prepped("/proc/mdstat", 100);2958 log_to_screen("Thank you.");2959 */2960 2948 unlink("/tmp/mondo-run-prog.tmp"); 2961 2949 set_signals(FALSE);
Note:
See TracChangeset
for help on using the changeset viewer.