Changeset 2405 in MondoRescue for branches/2.2.10/mondo/src/common
- Timestamp:
- Sep 17, 2009, 3:45:24 AM (15 years ago)
- Location:
- branches/2.2.10/mondo/src/common
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2383 r2405 979 979 void *create_afio_files_in_background(void *inbuf) 980 980 { 981 long int archiving_set_no ;982 char *archiving_filelist_fname ;983 char *archiving_afioball_fname ;981 long int archiving_set_no = 0L; 982 char *archiving_filelist_fname = NULL; 983 char *archiving_afioball_fname = NULL; 984 984 char *curr_xattr_list_fname = NULL; 985 985 char *curr_acl_list_fname = NULL; … … 994 994 int this_thread_no = g_current_thread_no++; 995 995 996 malloc_string(archiving_filelist_fname);997 malloc_string(archiving_afioball_fname);998 996 p_last_set_archived = (int *) inbuf; 999 997 p_archival_threads_running = (int *) (inbuf + 4); … … 1002 1000 bkpinfo_bis = (struct s_bkpinfo *) (inbuf + BKPINFO_LOC_OFFSET); 1003 1001 1004 sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, 0L);1005 for (archiving_set_no = 0; does_file_exist(archiving_filelist_fname); 1006 sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no)) {1002 mr_asprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, 0L); 1003 1004 while (does_file_exist(archiving_filelist_fname)) { 1007 1005 if (g_exiting) { 1006 mr_free(archiving_filelist_fname); 1008 1007 fatal_error("Execution run aborted (pthread)"); 1009 1008 } 1010 1009 if (archiving_set_no >= MAX_NOOF_SETS_HERE) { 1010 mr_free(archiving_filelist_fname); 1011 1011 fatal_error("Maximum number of filesets exceeded. Adjust MAX_NOOF_SETS_HERE, please."); 1012 1012 } 1013 1013 if (!semaphore_p()) { 1014 1014 log_msg(3, "P sem failed (pid=%d)", (int) getpid()); 1015 mr_free(archiving_filelist_fname); 1015 1016 fatal_error("Cannot get semaphore P"); 1016 1017 } … … 1020 1021 *p_next_set_to_archive = *p_next_set_to_archive + 1; 1021 1022 if (!semaphore_v()) { 1023 mr_free(archiving_filelist_fname); 1022 1024 fatal_error("Cannot get semaphore V"); 1023 1025 } 1024 1026 1025 1027 /* backup this set of files */ 1026 sprintf(archiving_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no, bkpinfo->zip_suffix); 1027 sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no); 1028 mr_asprintf(archiving_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no, bkpinfo->zip_suffix); 1029 mr_free(archiving_filelist_fname); 1030 mr_asprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no); 1028 1031 if (!does_file_exist(archiving_filelist_fname)) { 1029 log_msg(3, 1030 "%s[%d:%d] - well, I would archive %d, except that it doesn't exist. I'll stop now.", 1031 FORTY_SPACES, getpid(), this_thread_no, 1032 archiving_set_no); 1032 log_msg(3, "[%d:%d] - well, I would archive %d, except that it doesn't exist. I'll stop now.", getpid(), this_thread_no, archiving_set_no); 1033 1033 break; 1034 1034 } … … 1036 1036 mr_asprintf(tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix); 1037 1037 if (does_file_exist(tmp)) { 1038 log_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES, 1039 getpid(), this_thread_no); 1038 log_msg(4, "[%d:%d] - waiting for storer", getpid(), this_thread_no); 1040 1039 while (does_file_exist(tmp)) { 1041 1040 sleep(1); … … 1045 1044 mr_free(tmp); 1046 1045 1047 log_msg(4, " %s[%d:%d] - EXATing %d...", FORTY_SPACES, getpid(),1048 this_thread_no, archiving_set_no); 1046 log_msg(4, "[%d:%d] - EXATing %d...", getpid(), this_thread_no, archiving_set_no); 1047 1049 1048 if (g_getfattr) { 1050 1049 mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no); … … 1058 1057 } 1059 1058 1060 log_msg(4, "%s[%d:%d] - archiving %d...", FORTY_SPACES, getpid(), 1061 this_thread_no, archiving_set_no); 1062 res = 1063 archive_this_fileset(archiving_filelist_fname, 1064 archiving_afioball_fname, 1065 archiving_set_no); 1059 log_msg(4, "[%d:%d] - archiving %d...", getpid(), this_thread_no, archiving_set_no); 1060 res = archive_this_fileset(archiving_filelist_fname, archiving_afioball_fname, archiving_set_no); 1061 mr_free(archiving_afioball_fname); 1062 1066 1063 retval += res; 1067 1064 … … 1069 1066 log_to_screen("Errors occurred while archiving set %ld. Please review logs.", archiving_set_no); 1070 1067 } 1068 1071 1069 if (!semaphore_p()) { 1070 mr_free(archiving_filelist_fname); 1072 1071 fatal_error("Cannot get semaphore P"); 1073 1072 } … … 1080 1079 1081 1080 if (!semaphore_v()) { 1081 mr_free(archiving_filelist_fname); 1082 1082 fatal_error("Cannot get semaphore V"); 1083 1083 } 1084 log_msg(4, "%s[%d:%d] - archived %d OK", FORTY_SPACES, getpid(), 1085 this_thread_no, archiving_set_no); 1084 log_msg(4, "[%d:%d] - archived %d OK", getpid(), this_thread_no, archiving_set_no); 1086 1085 archiving_set_no++; 1087 } 1086 1087 mr_free(archiving_filelist_fname); 1088 mr_asprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no); 1089 } 1090 mr_free(archiving_filelist_fname); 1091 1088 1092 if (!semaphore_p()) { 1089 1093 fatal_error("Cannot get semaphore P"); … … 1093 1097 fatal_error("Cannot get semaphore V"); 1094 1098 } 1095 log_msg(3, "%s[%d:%d] - exiting", FORTY_SPACES, getpid(), 1096 this_thread_no); 1097 paranoid_free(archiving_filelist_fname); 1098 paranoid_free(archiving_afioball_fname); 1099 log_msg(3, "[%d:%d] - exiting", getpid(), this_thread_no); 1099 1100 pthread_exit(NULL); 1100 1101 } … … 1327 1328 assert(bkpinfo != NULL); 1328 1329 malloc_string(result_str); 1329 transfer_block = 1330 malloc(sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64); 1330 transfer_block = malloc(sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64); 1331 1331 memset((void *) transfer_block, 0, 1332 1332 sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64); … … 1638 1638 char *message_to_screen = NULL; 1639 1639 char *sz_blank_disk = NULL; 1640 char *fnam;1641 1640 char *tmp2 = NULL; 1642 1641 char *tmp3 = NULL; … … 1645 1644 1646 1645 malloc_string(old_pwd); 1647 malloc_string(fnam);1648 1646 assert(bkpinfo != NULL); 1649 1647 assert_string_is_neither_NULL_nor_zerolength(destfile); … … 1879 1877 } 1880 1878 paranoid_free(old_pwd); 1881 paranoid_free(fnam);1882 1879 return (retval); 1883 1880 } … … 2529 2526 /** 2530 2527 * Make sure the user has a valid CD-R(W) in the CD drive. 2531 * @param cdrw_dev Set to the CD-R(W) device checked. 2532 * @param keep_looping If TRUE, keep pestering user until they insist 2533 * or insert a correct CD; if FALSE, only check once. 2534 * @return 0 (there was an OK CD in the drive) or 1 (there wasn't). 2535 */ 2536 int interrogate_disk_currently_in_cdrw_drive(char *cdrw_dev, bool keep_looping) { 2537 int res = 0; 2538 char *bkp = NULL; 2528 * @return the CD-R(W) device checked or NULL 2529 */ 2530 char *interrogate_disk_currently_in_cdrw_drive(char *cdrw_dev) { 2539 2531 char *cdrecord = NULL; 2540 2541 mr_asprintf(bkp, "%s", cdrw_dev); 2542 if (find_cdrw_device(cdrw_dev)) { 2543 strcpy(cdrw_dev, bkp); 2544 } else { 2532 char *cdrw_dev = NULL; 2533 2534 cdrw_dev = find_cdrw_device(); 2535 if (cdrw_dev != NULL) { 2545 2536 if (!system("which cdrecord > /dev/null 2> /dev/null")) { 2546 2537 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev); … … 2551 2542 } 2552 2543 if (cdrecord != NULL) { 2553 if (!keep_looping) { 2554 retract_CD_tray_and_defeat_autorun(); 2555 res = run_program_and_log_output(cdrecord, 5); 2556 } else { 2557 while ((res = run_program_and_log_output(cdrecord, 5))) { 2558 retract_CD_tray_and_defeat_autorun(); 2559 if (ask_me_yes_or_no 2560 ("Unable to examine CD. Are you sure this is a valid CD-R(W) CD?")) 2561 { 2562 log_msg(1, "Well, he insisted..."); 2563 break; 2564 } 2565 } 2544 retract_CD_tray_and_defeat_autorun(); 2545 if (run_program_and_log_output(cdrecord, 5)) { 2546 /* As it didn't work, return NULL */ 2547 mr_free(cdrw_dev); 2566 2548 } 2567 2549 } 2568 } 2569 mr_free(bkp); 2570 2571 mr_free(cdrecord); 2572 return (res); 2550 mr_free(cdrecord); 2551 } 2552 return(cdrw_dev); 2573 2553 } 2574 2554 … … 2586 2566 char *tmp = NULL; 2587 2567 char *cdrom_dev = NULL; 2588 char *cdrw_dev ;2568 char *cdrw_dev = NULL; 2589 2569 char *our_serial_str = NULL; 2590 2570 bool ok_go_ahead_burn_it; … … 2592 2572 int attempt_to_mount_returned_this = 999; 2593 2573 char *mtpt = NULL; 2594 char *szcdno ;2595 char *szserfname ;2596 char *szunmount ;2574 char *szcdno = NULL; 2575 char *szserfname = NULL; 2576 char *szunmount = NULL; 2597 2577 char *mds = NULL; 2598 2599 malloc_string(cdrw_dev);2600 malloc_string(szcdno);2601 malloc_string(szserfname);2602 malloc_string(szunmount);2603 2578 2604 2579 mds = media_descriptor_string(g_backup_media_type); … … 2621 2596 mr_asprintf(tmp, "umount %s", cdrom_dev); 2622 2597 run_program_and_log_output(tmp, 1); 2623 sprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt);2624 sprintf(szserfname, "%s/archives/SERIAL-STRING", mtpt);2625 sprintf(szunmount, "umount %s", mtpt);2598 mr_asprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt); 2599 mr_asprintf(szserfname, "%s/archives/SERIAL-STRING", mtpt); 2600 mr_asprintf(szunmount, "umount %s", mtpt); 2626 2601 cd_number = -1; 2627 2602 mr_asprintf(tmp, "mount %s %s", cdrom_dev, mtpt); … … 2629 2604 attempt_to_mount_returned_this = run_program_and_log_output(tmp, 1); 2630 2605 mr_free(tmp); 2606 2631 2607 if (attempt_to_mount_returned_this) { 2632 2608 log_msg(4, "Failed to mount %s at %s", cdrom_dev, mtpt); 2633 2609 log_to_screen("If there's a CD/DVD in the drive, it's blank."); 2634 /* 2635 if (interrogate_disk_currently_in_cdrw_drive(cdrw_dev, FALSE)) 2636 { 2637 ok_go_ahead_burn_it = FALSE; 2638 log_to_screen("There isn't a writable CD/DVD in the drive."); 2639 } 2640 else 2641 { 2642 log_to_screen("Confirmed. There is a blank CD/DVD in the drive."); 2643 } 2644 */ 2645 } else if (!does_file_exist(szcdno) 2646 || !does_file_exist(szserfname)) { 2610 } else if (!does_file_exist(szcdno) || !does_file_exist(szserfname)) { 2647 2611 mds = media_descriptor_string(g_backup_media_type); 2648 log_to_screen 2649 ("%s has data on it but it's probably not a Mondo CD.", mds); 2612 log_to_screen("%s has data on it but it's probably not a Mondo CD.", mds); 2650 2613 mr_free(mds); 2651 2614 } else { … … 2664 2627 // FIXME - should be able to use last_line_of_file(), surely? 2665 2628 } 2629 mr_free(szcdno); 2630 mr_free(szserfname); 2631 2666 2632 run_program_and_log_output(szunmount, 1); 2633 mr_free(szunmount); 2634 2667 2635 log_msg(2, "paafcd: cd_number = %d", cd_number); 2668 2636 log_msg(2, "our serial str = %s; g_serial_string = %s", our_serial_str, g_serial_string); … … 2686 2654 log_msg(2, 2687 2655 "paafcd: Can't find CD-ROM drive. Perhaps it has a blank %s in it?", mds); 2688 if (interrogate_disk_currently_in_cdrw_drive(cdrw_dev, FALSE)) { 2656 cdrw_dev = interrogate_disk_currently_in_cdrw_drive(); 2657 if (cdrw_dev == NULL) { 2689 2658 ok_go_ahead_burn_it = FALSE; 2690 2659 log_to_screen("There isn't a writable %s in the drive.", mds); 2691 2660 } 2661 mr_free(cdrw_dev); 2692 2662 mr_free(mds); 2693 2663 } … … 2709 2679 2710 2680 mds = media_descriptor_string(g_backup_media_type); 2711 log_msg(2, 2712 "paafcd: OK, I assume I have a blank/reusable %s in the drive...", mds); 2681 log_msg(2, "paafcd: OK, I assume I have a blank/reusable %s in the drive...", mds); 2713 2682 2714 2683 log_to_screen("Proceeding w/ %s in drive.", mds); 2715 2684 mr_free(mds); 2716 2685 2717 paranoid_free(cdrw_dev);2718 2686 paranoid_free(mtpt); 2719 paranoid_free(szcdno);2720 paranoid_free(szserfname);2721 paranoid_free(szunmount);2722 2687 if (pmountable) { 2723 2688 if (attempt_to_mount_returned_this) { … … 2729 2694 2730 2695 } 2731 2732 2733 2734 2735 2736 2737 2696 2738 2697 … … 2764 2723 2765 2724 /* @} - end of utilityGroup */ 2766 2767 2768 2769 2770 2771 2772 2725 2773 2726 -
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2389 r2405 654 654 655 655 /*@ buffers ** */ 656 char *tmp = NULL;657 656 char *tmp1 = NULL; 658 657 char *tmp2 = NULL; … … 668 667 669 668 struct stat buf; 670 671 malloc_string(tmp);672 669 673 670 assert(bkpinfo != NULL); … … 1377 1374 finish(0); 1378 1375 } 1379 mr_free(tmp);1380 1376 1381 1377 if ((flag_set['L']) && (! bkpinfo->restore_data)) { -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2400 r2405 1407 1407 char *tmp = NULL; 1408 1408 char *p = NULL; 1409 char *tmp1 = NULL;1410 1409 char *mds = NULL; 1411 1410 char *sz_size = NULL; 1412 1411 char *command = NULL; 1413 1412 char *comment = NULL; 1414 char *prompt;1415 1413 int i; 1416 1414 FILE *fin; 1417 1415 1418 malloc_string(prompt);1419 malloc_string(tmp1);1420 1416 assert(bkpinfo != NULL); 1421 1417 bkpinfo->nonbootable_backup = FALSE; … … 1456 1452 if (archiving_to_media) { 1457 1453 if ((bkpinfo->backup_media_type != dvd) && (bkpinfo->backup_media_type != usb)) { 1458 if (ask_me_yes_or_no 1459 ("Is your computer a laptop, or does the CD writer incorporate BurnProof technology?")) 1460 { 1454 if (ask_me_yes_or_no("Is your computer a laptop, or does the CD writer incorporate BurnProof technology?")) { 1461 1455 bkpinfo->manual_cd_tray = TRUE; 1462 1456 } 1463 1457 } 1464 if ((bkpinfo->compression_level = 1465 which_compression_level()) == -1) { 1458 if ((bkpinfo->compression_level = which_compression_level()) == -1) { 1466 1459 log_to_screen("User has chosen not to backup the PC"); 1467 1460 finish(1); … … 1495 1488 mr_free(comment); 1496 1489 1497 bkpinfo->cdrw_speed = atoi(tmp1); // if DVD then this shouldn't ever be used anyway :) 1490 bkpinfo->cdrw_speed = atoi(tmp); // if DVD then this shouldn't ever be used anyway :) 1491 mr_free(tmp); 1498 1492 1499 1493 mr_asprintf(comment, "How much data (in Megabytes) will each %s store?", mds); … … 2022 2016 } 2023 2017 paranoid_free(sz_size); 2024 paranoid_free(tmp1);2025 paranoid_free(prompt);2026 2018 return (0); 2027 2019 } -
branches/2.2.10/mondo/src/common/libmondo-filelist.c
r2404 r2405 1507 1507 char *sz_filelist; 1508 1508 char *exclude_paths = NULL; 1509 char *tmp;1510 1509 int i; 1511 1510 FILE *fout; … … 1516 1515 char *tmp2 = NULL; 1517 1516 1518 malloc_string(tmp);1519 malloc_string(g_skeleton_filelist);1520 1517 mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0); 1521 1518 if (!include_paths && !userdef_filelist) { … … 1587 1584 log_msg(2, "Excluding paths = '%s'", exclude_paths); 1588 1585 log_msg(2, "Generating skeleton filelist so that we can track our progress"); 1589 sprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir);1586 mr_asprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir); 1590 1587 make_hole_for_file(g_skeleton_filelist); 1591 1588 log_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries); … … 1631 1628 paranoid_free(sz_filelist); 1632 1629 log_msg(2, "Freeing variables"); 1633 paranoid_free(tmp); 1634 paranoid_free(g_skeleton_filelist); 1630 mr_free(g_skeleton_filelist); 1635 1631 log_msg(2, "Exiting"); 1636 1632 return (0); -
branches/2.2.10/mondo/src/common/libmondo-fork.c
r2392 r2405 95 95 * @return Exit code of @c mkisofs (0 is success, anything else indicates failure). 96 96 */ 97 int 98 eval_call_to_make_ISO(char *basic_call, char *isofile, int cd_no, char *what_i_am_doing) { 97 int eval_call_to_make_ISO(char *basic_call, char *isofile, int cd_no, char *what_i_am_doing) { 99 98 100 99 /*@ int's *** */ … … 106 105 char *ultimate_call = NULL; 107 106 char *tmp = NULL; 108 char *incoming, *old_stderr;109 107 110 108 char *cd_number_str = NULL; … … 119 117 assert(bkpinfo != NULL); 120 118 assert_string_is_neither_NULL_nor_zerolength(isofile); 121 malloc_string(incoming);122 malloc_string(old_stderr);123 124 incoming[0] = '\0';125 old_stderr[0] = '\0';126 119 127 120 if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) { … … 187 180 } 188 181 mr_free(command); 189 paranoid_free(incoming);190 paranoid_free(old_stderr);191 182 return (retval); 192 183 } -
branches/2.2.10/mondo/src/common/libmondo-raid.c
r2357 r2405 591 591 { 592 592 FILE *fin; 593 char *tmp;594 593 char *label; 595 594 char *value; … … 597 596 int v; 598 597 599 malloc_string(tmp);600 malloc_string(label);601 malloc_string(value);602 598 assert(raidlist != NULL); 603 599 assert_string_is_neither_NULL_nor_zerolength(fname); … … 606 602 log_it("Raidtab is very small or non-existent. Ignoring it."); 607 603 raidlist->entries = 0; 608 paranoid_free(tmp);609 paranoid_free(label);610 paranoid_free(value);611 604 return (0); 612 605 } 613 606 if (!(fin = fopen(fname, "r"))) { 614 607 log_it("Cannot open raidtab"); 615 paranoid_free(tmp);616 paranoid_free(label);617 paranoid_free(value);618 608 return (1); 619 609 } 620 610 items = 0; 621 611 log_it("Loading raidtab..."); 612 malloc_string(label); 613 malloc_string(value); 622 614 get_next_raidtab_line(fin, label, value); 623 615 while (!feof(fin)) { … … 631 623 v++; 632 624 get_next_raidtab_line(fin, label, value); 633 log_it(tmp);634 625 } 635 626 raidlist->el[items].additional_vars.entries = v; … … 651 642 log_msg(1, "Raidtab loaded successfully."); 652 643 log_msg(1, "%d RAID devices in raidtab", items); 653 paranoid_free(tmp);654 644 paranoid_free(label); 655 645 paranoid_free(value); -
branches/2.2.10/mondo/src/common/libmondo-stream.c
r2383 r2405 1315 1315 while (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 1316 1316 res = 1317 read_header_block_from_stream(&temp_size, temp_fname, 1318 &ctrl_chr); 1317 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1319 1318 if (ctrl_chr == BLK_START_AN_AFIO_OR_SLICE) { 1320 1319 break; … … 1326 1325 while (ctrl_chr != BLK_START_FILE) { 1327 1326 res = 1328 read_header_block_from_stream(&temp_size, temp_fname, 1329 &ctrl_chr); 1327 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1330 1328 if (ctrl_chr == BLK_START_FILE) { 1331 1329 break; … … 1348 1346 } 1349 1347 while (strcmp(pA, pB)) { 1350 log_msg(6, "Skipping %s (it's not %s)", temp_fname, 1351 the_file_I_was_reading); 1348 log_msg(6, "Skipping %s (it's not %s)", temp_fname, the_file_I_was_reading); 1352 1349 for (size = temp_size; size > 0; size -= bytes_to_write) { 1353 1350 bytes_to_write = … … 1357 1354 } 1358 1355 res = 1359 read_header_block_from_stream(&temp_size, temp_fname, 1360 &ctrl_chr); 1356 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1361 1357 if (ctrl_chr != BLK_STOP_FILE) { 1362 1358 wrong_marker(BLK_STOP_FILE, ctrl_chr); 1363 1359 } 1364 1360 res = 1365 read_header_block_from_stream(&temp_size, temp_fname, 1366 &ctrl_chr); 1361 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1367 1362 if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) { 1368 1363 wrong_marker(BLK_STOP_AN_AFIO_OR_SLICE, ctrl_chr); 1369 1364 } 1370 1365 res = 1371 read_header_block_from_stream(&temp_size, temp_fname, 1372 &ctrl_chr); 1366 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1373 1367 if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 1374 1368 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 1375 1369 } 1376 1370 res = 1377 read_header_block_from_stream(&temp_size, temp_fname, 1378 &ctrl_chr); 1371 read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1379 1372 if (ctrl_chr != BLK_START_FILE) { 1380 1373 wrong_marker(BLK_START_FILE, ctrl_chr); … … 1393 1386 } 1394 1387 } 1395 log_msg(2, "Reading %s (it matches %s)", temp_fname, 1396 the_file_I_was_reading); 1388 log_msg(2, "Reading %s (it matches %s)", temp_fname, the_file_I_was_reading); 1397 1389 paranoid_free(temp_fname); 1398 1390 paranoid_free(datablock); -
branches/2.2.10/mondo/src/common/libmondo-string.c
r2400 r2405 202 202 long outval; 203 203 int i; 204 char *tmp;205 204 char *tmp1 = NULL; 206 205 char ch; … … 208 207 assert_string_is_neither_NULL_nor_zerolength(incoming); 209 208 210 malloc_string(tmp);211 209 if (!incoming[0]) { 212 free(tmp);213 210 return (0); 214 211 } … … 216 213 fatal_error("Please use integers only. No decimal points."); 217 214 } 218 strcpy(tmp, incoming); 219 i = (int) strlen(tmp); 220 if (tmp[i - 1] == 'B' || tmp[i - 1] == 'b') { 221 tmp[i - 1] = '\0'; 222 } 223 for (i = 0; i < (int) strlen(tmp) && isdigit(tmp[i]); i++); 224 ch = tmp[i]; 225 tmp[i] = '\0'; 226 outval = atol(tmp); 227 paranoid_free(tmp); 215 216 mr_asprintf(tmp1, "%s", incoming); 217 i = (int) strlen(tmp1); 218 if (tmp1[i - 1] == 'B' || tmp1[i - 1] == 'b') { 219 tmp1[i - 1] = '\0'; 220 } 221 for (i = 0; i < (int) strlen(tmp1) && isdigit(tmp1[i]); i++); 222 ch = tmp1[i]; 223 tmp1[i] = '\0'; 224 outval = atol(tmp1); 225 paranoid_free(tmp1); 226 228 227 if (ch == 'g' || ch == 'G') { 229 228 outval = outval * 1024; -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2383 r2405 393 393 char *mondo_mkisofs_sz = NULL; 394 394 char *command = NULL; 395 char *mtpt;396 395 char *hostname = NULL; 397 396 char *ip_address = NULL; … … 413 412 } 414 413 415 malloc_string(mtpt);416 414 bkpinfo->optimal_set_size = 417 415 (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type) ? 16 : 16) * … … 700 698 } 701 699 g_backup_media_type = bkpinfo->backup_media_type; 702 paranoid_free(mtpt);703 700 return (retval); 704 701 }
Note:
See TracChangeset
for help on using the changeset viewer.