Changeset 3892 in MondoRescue for branches/3.3/mondo/src/common
- Timestamp:
- Mar 12, 2024, 3:10:24 AM (3 months ago)
- Location:
- branches/3.3/mondo/src/common
- Files:
-
- 10 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);
Note:
See TracChangeset
for help on using the changeset viewer.