- Timestamp:
- Sep 25, 2013, 8:55:43 AM (12 years ago)
- Location:
- branches/3.1/mondo/src/common
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.1/mondo/src/common/libmondo-archive.c
r3161 r3190 503 503 /*@ buffer ************************************************************ */ 504 504 char *tmp = NULL; 505 char *tmp1 = NULL; 505 506 char *tmp2 = NULL; 506 507 char *command = NULL; … … 513 514 char *bootldr_ver = NULL; 514 515 char *tape_device = NULL; 516 char *last_filelist_number = NULL; 515 517 char *broken_bios_sz = NULL; 516 518 char *cd_recovery_sz = NULL; … … 535 537 assert(bkpinfo != NULL); 536 538 539 mvaddstr_and_log_it(g_currentY, 0, "Calling MINDI to create boot+data disks"); 540 open_evalcall_form("Calling MINDI to create boot+data disks"); 537 541 mr_asprintf(tmp, "%s/filelist.full", bkpinfo->tmpdir); 538 542 if (!does_file_exist(tmp)) { … … 547 551 mr_free(tmp); 548 552 553 mr_asprintf(tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir); 554 mr_asprintf(last_filelist_number, "%s", last_line_of_file(tmp)); 555 mr_free(tmp); 556 549 557 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 550 mr_asprintf(tape_size_sz, "%ld", bkpinfo->media_size [1]);558 mr_asprintf(tape_size_sz, "%ld", bkpinfo->media_size); 551 559 if (bkpinfo->media_device) { 552 560 ntapedev = get_non_rewind_dev(bkpinfo->media_device); … … 721 729 } 722 730 log_to_screen("Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device); 731 723 732 if (bootldr_ver != NULL) { 724 mr_asprintf(tmp, "Boot loader version string: %s", bootldr_ver); 725 log_to_screen(tmp); 726 mr_free(tmp); 727 } 728 if (bootldr_ver != NULL) { 729 mr_asprintf(tmp, "Boot loader version string: %s", bootldr_ver); 730 log_to_screen(tmp); 731 mr_free(tmp); 733 log_to_screen("Boot loader version string: %s", bootldr_ver); 732 734 } 733 735 … … 776 778 } 777 779 780 mr_asprintf(tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir); 781 if (write_one_liner_data_file(tmp, value)) { 782 res++; 783 log_msg(1, "%ld: Unable to write one-liner backup-media-type", __LINE__); 784 } 785 mr_free(value); 786 mr_free(tmp); 787 778 788 mr_asprintf(tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir); 779 789 if (write_one_liner_data_file(tmp, bootldr_str)) { … … 784 794 mr_free(tmp); 785 795 796 mr_asprintf(tmp, "%s/BOOTLOADER.VER", bkpinfo->tmpdir); 797 if (write_one_liner_data_file(tmp, bootldr_ver)) { 798 res++; 799 log_msg(1, "%ld: Unable to write one-liner bootloader.ver", 800 __LINE__); 801 } 802 mr_free(bootldr_ver); 803 mr_free(tmp); 804 805 mr_asprintf(tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir); 806 if (bkpinfo->differential) { 807 res += write_one_liner_data_file(tmp, "1"); 808 } else { 809 res += write_one_liner_data_file(tmp, "0"); 810 } 811 mr_free(tmp); 812 813 if (g_getfattr) { 814 mr_asprintf(tmp1, "%s/XATTR", bkpinfo->tmpdir); 815 if (write_one_liner_data_file(tmp1, "TRUE")) { 816 log_msg(1, "%ld: Unable to write one-liner XATTR", 817 __LINE__); 818 } 819 paranoid_free(tmp1); 820 } 821 if (g_getfacl) { 822 mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir); 823 if (write_one_liner_data_file(tmp1, "TRUE")) { 824 log_msg(1, "%ld: Unable to write one-liner ACL", 825 __LINE__); 826 } 827 paranoid_free(tmp1); 828 } 829 if (bkpinfo->use_obdr) { 830 mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir); 831 if (write_one_liner_data_file(tmp1, "TRUE")) { 832 log_msg(1, "%ld: Unable to write one-liner OBDR", 833 __LINE__); 834 } 835 paranoid_free(tmp1); 836 } 837 786 838 estimated_total_noof_slices = size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1; 787 839 788 /* BERLIOS: add netfs stuff here? */840 /* TODO: add netfs stuff here? */ 789 841 mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir); 790 842 if (system(command)) { … … 796 848 update_evalcall_form(3); 797 849 798 /* 1 2 3 4 5 6 7 8 9 10 */ 799 mr_asprintf(command, "mindi %s --custom %s %s/images '%s' '%s' '%s' %ld '%s' '%s' '%s'\800 '%s' %ld '%s' '%s' '%s' '%s' %ld %d '%s' '%s' '%s' >> %s", 801 /* 11 12 13 14 15 16 17 18 19 20 21 last */ 802 tmp2, // parameter #1 803 850 /* "mindi --custom 2=%s 3=%s/images 4=\"%s\" 5=\"%s\" \ 851 6=\"%s\" 7=%ld 8=\"%s\" 9=\"%s\" 10=\"%s\" \ 852 11=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/ 853 mr_asprintf(command, "mindi %s --custom %s %s/images '%s' '%s' \ 854 '%s' %ld '%s' '%s' '%s' \ 855 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'", tmp2, bkpinfo->tmpdir, // parameter #2 804 856 bkpinfo->scratchdir, // parameter #3 805 857 bkpinfo->kernel_path, // parameter #4 … … 811 863 (bkpinfo->image_devs == NULL) ? "\"\"" : bkpinfo->image_devs, // parameter #10 812 864 broken_bios_sz, // parameter #11 813 estimated_total_noof_slices, // parameter #12 (INT) 814 (bkpinfo->exclude_devs == NULL) ? "\"\"" : bkpinfo->exclude_devs, // parameter #13 815 use_comp_sz, // parameter #14 816 use_lilo_sz, // parameter #15 817 use_star_sz, // parameter #16 818 bkpinfo->internal_tape_block_size, // parameter #17 (LONG) 819 bkpinfo->differential, // parameter #18 (INT) 865 last_filelist_number, // parameter #12 (STRING) 866 estimated_total_noof_slices, // parameter #13 (INT) 867 (bkpinfo->exclude_devs == NULL) ? "\"\"" : bkpinfo->exclude_devs, // parameter #14 868 use_comp_sz, // parameter #15 869 use_lilo_sz, // parameter #16 870 use_star_sz, // parameter #17 871 bkpinfo->internal_tape_block_size, // parameter #18 (LONG) 872 bkpinfo->differential, // parameter #19 (INT) 820 873 use_gzip_sz, // parameter #19 (STRING) 821 874 use_lzma_sz, // parameter #20 (STRING) … … 823 876 MONDO_LOGFILE); 824 877 825 mr_free(value); 826 mr_free(tmp2); 878 mr_free(last_filelist_number); 827 879 mr_free(tape_device); 828 880 mr_free(use_lzo_sz); … … 844 896 // popup_and_OK("Pausing"); 845 897 846 mvaddstr_and_log_it(g_currentY, 0, "Calling MINDI to create boot+data disks");847 open_evalcall_form("Calling MINDI to create boot+data disks");848 898 res = run_external_binary_with_percentage_indicator_NEW("Generating boot+data disks", command); 849 899 update_evalcall_form(99); … … 872 922 run_program_and_log_output(command, FALSE); 873 923 mr_free(command); 924 } else { 925 mr_asprintf(tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir); 926 if (system(tmp)) { 927 fatal_error("Cannot find all.tar.gz in tmpdir"); 928 } 929 mr_free(tmp); 874 930 } 875 931 if (res) { … … 982 1038 mr_asprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no); 983 1039 if (!does_file_exist(archiving_filelist_fname)) { 984 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);1040 log_msg(3, "%s[%d:%d] - well, I would archive %d, except that it doesn't exist. I'll stop now.", FORTY_SPACES, getpid(), this_thread_no, archiving_set_no); 985 1041 mr_free(archiving_afioball_fname); 986 1042 break; … … 989 1045 mr_asprintf(tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix); 990 1046 if (does_file_exist(tmp)) { 991 log_msg(4, " [%d:%d] - waiting for storer", getpid(), this_thread_no);1047 log_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES, getpid(), this_thread_no); 992 1048 while (does_file_exist(tmp)) { 993 1049 sleep(1); … … 997 1053 mr_free(tmp); 998 1054 999 log_msg(4, " [%d:%d] - EXATing %d...", getpid(), this_thread_no, archiving_set_no);1055 log_msg(4, "%s[%d:%d] - EXATing %d...", FORTY_SPACES, getpid(), this_thread_no, archiving_set_no); 1000 1056 1001 1057 if (g_getfattr) { … … 1010 1066 } 1011 1067 1012 log_msg(4, " [%d:%d] - archiving %d...", getpid(), this_thread_no, archiving_set_no);1068 log_msg(4, "%s[%d:%d] - archiving %d...", FORTY_SPACES, getpid(), this_thread_no, archiving_set_no); 1013 1069 res = archive_this_fileset(archiving_filelist_fname, archiving_afioball_fname, archiving_set_no); 1014 1070 mr_free(archiving_afioball_fname); … … 1035 1091 fatal_error("Cannot get semaphore V"); 1036 1092 } 1037 log_msg(4, " [%d:%d] - archived %d OK", getpid(), this_thread_no, archiving_set_no);1093 log_msg(4, "%s[%d:%d] - archived %d OK", FORTY_SPACES, getpid(), this_thread_no, archiving_set_no); 1038 1094 archiving_set_no++; 1039 1095 … … 1050 1106 fatal_error("Cannot get semaphore V"); 1051 1107 } 1052 log_msg(3, " [%d:%d] - exiting", getpid(), this_thread_no);1108 log_msg(3, "%s[%d:%d] - exiting", FORTY_SPACES, getpid(), this_thread_no); 1053 1109 pthread_exit(NULL); 1054 1110 } … … 1338 1394 if (!get_bit_N_of_array 1339 1395 (p_list_of_fileset_flags, storing_set_no)) { 1340 misc_counter_that_is_not_important = (misc_counter_that_is_not_important + 1) % 5; 1341 sleep(1); 1396 misc_counter_that_is_not_important = (misc_counter_that_is_not_important + 1) % 5; 1397 /* BCO the media_usage_comment is not really initialized there ! 1398 if (!misc_counter_that_is_not_important) { 1399 update_progress_form(media_usage_comment); 1400 } 1401 */ 1402 sleep(1); 1342 1403 } else { 1343 1404 // store set N … … 1765 1826 log_msg(1, "Non-ia64 --> lilo"); 1766 1827 mr_asprintf(full_isofs_cmd, "%s%s-b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -V _CD#_ .",isofs_cmd,MONDO_MKISOFS); 1767 1828 // FIXME: fixed boot size probably wrong. lilo to be removed 1768 1829 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen); 1830 mr_free(full_isofs_cmd); 1769 1831 #endif 1770 1832 } else { … … 1773 1835 mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_SYSLINUX); 1774 1836 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, message_to_screen); 1775 }1776 mr_free(full_isofs_cmd);1837 mr_free(full_isofs_cmd); 1838 } 1777 1839 } 1778 1840 mr_free(isofs_cmd); … … 2002 2064 } 2003 2065 retval += res; 2066 p = strrchr(bigfile_fname, '/'); 2067 if (p) { 2068 p++; 2069 } else { 2070 p = bigfile_fname; 2071 } 2004 2072 mr_asprintf(tmp, "Archiving %s ... ", bigfile_fname); 2005 2073 if (res) { … … 2239 2307 } 2240 2308 2309 mr_asprintf(command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir, biggielist); 2310 paranoid_system(command); 2311 mr_free(command); 2312 2241 2313 mr_asprintf(blah, "biggielist = %s", biggielist); 2242 2314 log_msg(2, blah); … … 2351 2423 va_end(ap); 2352 2424 2353 if (bkpinfo->media_size [g_current_media_number]<= 0) {2425 if (bkpinfo->media_size <= 0) { 2354 2426 fatal_error("move_files_to_cd() - unknown media size"); 2355 2427 } 2356 if (would_occupy / 1024 > bkpinfo->media_size [g_current_media_number]) {2428 if (would_occupy / 1024 > bkpinfo->media_size) { 2357 2429 res = write_iso_and_go_on(FALSE); /* FALSE because this is not the last CD we'll write */ 2358 2430 retval += res; … … 2707 2779 char *checksum_line = NULL; 2708 2780 char *command = NULL; 2709 char *tempblock ;2781 char *tempblock = NULL; 2710 2782 char *curr_slice_fname_uncompressed = NULL; 2711 2783 char *curr_slice_fname_compressed = NULL; … … 2834 2906 } 2835 2907 i = bkpinfo->optimal_set_size / 256; 2908 if (!(tempblock = (char *) malloc(256 * 1024))) { 2909 fatal_error("malloc error 256*1024"); 2910 } 2836 2911 for (slice_num = 1; !finished; slice_num++) { 2837 2912 mr_asprintf(curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, "")); … … 2849 2924 } 2850 2925 if ((i == bkpinfo->optimal_set_size / 256) && (totalread < 1.1 * totallength)) { 2851 tempblock = mr_malloc(256 * 1024);2852 2926 for (i = 0L; i < bkpinfo->optimal_set_size / 256; i++) { 2853 2927 blksize = fread(tempblock, 1, 256 * 1024, fin); … … 3071 3145 assert(bkpinfo != NULL); 3072 3146 orig_vfy_flag_val = bkpinfo->verify_data; 3073 if (bkpinfo->media_size [g_current_media_number]<= 0) {3147 if (bkpinfo->media_size <= 0) { 3074 3148 fatal_error("write_iso_and_go_on() - unknown media size"); 3075 3149 } … … 3108 3182 mr_free(lastcd_fname); 3109 3183 3110 if (space_occupied_by_cd(bkpinfo->scratchdir) / 1024 > 3111 bkpinfo->media_size[g_current_media_number]) { 3112 log_to_screen("Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.", (long) space_occupied_by_cd(bkpinfo->scratchdir), (long) bkpinfo->media_size[g_current_media_number]); 3184 if (space_occupied_by_cd(bkpinfo->scratchdir) / 1024 > bkpinfo->media_size) { 3185 log_to_screen("Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.",(long) space_occupied_by_cd(bkpinfo->scratchdir),(long) bkpinfo->media_size); 3113 3186 } 3114 3187 if (((bkpinfo->isodir == NULL) && (bkpinfo->netfs_remote_dir == NULL)) || (bkpinfo->prefix == NULL)) { … … 3181 3254 3182 3255 g_current_media_number++; 3183 if (g_current_media_number > MAX_NOOF_MEDIA) {3184 fatal_error("Too many media. Use tape or net.");3185 }3186 3256 wipe_archives(bkpinfo->scratchdir); 3187 3257 mr_asprintf(tmp1, "rm -Rf %s/images/*gz %s/images/*data*img", bkpinfo->scratchdir, bkpinfo->scratchdir); -
branches/3.1/mondo/src/common/libmondo-cli.c
r3161 r3190 39 39 40 40 extern void setup_tmpdir(char *path); 41 extern void setup_scratchdir(char *path); 41 42 void mr_make_devlist_from_pathlist(char *pathlist, char mode); 42 43 extern double g_kernel_version; … … 85 86 flag_set[i] = FALSE; 86 87 } 87 for (j = 1; j <= MAX_NOOF_MEDIA; j++) { 88 bkpinfo->media_size[j] = 650; 89 } /* default */ 88 bkpinfo->media_size = 650; /* default */ 90 89 res = retrieve_switches_from_command_line(argc, argv, flag_val, flag_set); 91 90 retval += res; … … 94 93 retval += res; 95 94 } 95 96 96 log_msg(3, "Switches:-"); 97 97 for (i = 0; i < 128; i++) { … … 100 100 } 101 101 } 102 mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); 103 paranoid_system(tmp); 104 mr_free(tmp); 105 106 /* Before erasing dirs go into a safe place */ 107 if (chdir("/tmp")) { 108 // FIXME 109 } 110 mr_asprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir); 111 paranoid_system(tmp); 112 mr_free(tmp); 113 114 mr_asprintf(tmp, "mkdir -p %s", bkpinfo->scratchdir); 115 paranoid_system(tmp); 116 mr_free(tmp); 102 117 103 return (retval); 118 104 } 119 120 121 105 122 106 … … 130 114 int process_the_s_switch(char *value) 131 115 { 132 int j;133 char tmp[MAX_STR_LEN], *p;134 135 116 assert(bkpinfo != NULL); 136 117 assert(value != NULL); 137 118 138 bkpinfo->media_size[0] = -1; /* dummy value */ 139 for (j = 1, p = value; j < MAX_NOOF_MEDIA && strchr(p, ','); 140 j++, p = strchr(p, ',') + 1) { 141 strncpy(tmp, p, MAX_STR_LEN); 142 *(strchr(tmp, ',')) = '\0'; 143 bkpinfo->media_size[j] = friendly_sizestr_to_sizelong(tmp); 144 log_msg(3, "media_size[%d] = %ld", j, bkpinfo->media_size[j]); 145 } 146 for (; j <= MAX_NOOF_MEDIA; j++) { 147 bkpinfo->media_size[j] = friendly_sizestr_to_sizelong(p); 148 } 149 for (j = 1; j <= MAX_NOOF_MEDIA; j++) { 150 if (bkpinfo->media_size[j] <= 0) { 151 log_msg(1, "You gave media #%d an invalid size\n", j); 152 return (-1); 153 } 119 bkpinfo->media_size = -1; /* dummy value */ 120 bkpinfo->media_size = friendly_sizestr_to_sizelong(value); 121 log_msg(3, "media_size = %ld", bkpinfo->media_size); 122 if (bkpinfo->media_size <= 0) { 123 log_msg(1, "You gave media an invalid size %s\n", value); 124 return (-1); 154 125 } 155 126 return (0); … … 269 240 retval++; 270 241 log_to_screen("Please supply a sensible value with '-I'\n"); 242 } 243 if (!strcmp(bkpinfo->include_paths, "/")) { 244 log_msg(2, "'/' is pleonastic."); 245 bkpinfo->include_paths[0] = '\0'; 246 } 247 if (bkpinfo->include_paths[0]) { 248 strcat(bkpinfo->include_paths, "|"); 271 249 } 272 250 … … 361 339 mr_free(tmp1); 362 340 flag_set['d'] = TRUE; 363 strcpy(flag_val['d'], p);364 mr_free(p);365 341 log_to_screen("You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']); 366 342 } … … 429 405 } 430 406 } else if (flag_set['u'] || flag_set['t']) { 431 for (i = 0; i <= MAX_NOOF_MEDIA; i++) { 432 bkpinfo->media_size[i] = 0; 433 } 407 bkpinfo->media_size = 0; 434 408 } else { 435 409 retval++; … … 483 457 /* p points on to the string server:/path */ 484 458 /* Store the 2 values */ 459 /* using memmove instead of strcpy as per #584 */ 460 /* memmove(bkpinfo->netfs_mount, p, MAX_STR_LEN); */ 485 461 bkpinfo->netfs_mount = p; 486 462 … … 492 468 p++; 493 469 /* new netfs mount */ 494 bkpinfo->netfs_mount = p; 470 mr_asprintf(bkpinfo->netfs_mount, "%s", p); 471 /* now that user is computed, create the right value by removing end of string */ 495 472 p--; 496 473 *p = '\0'; … … 506 483 if (strstr(bkpinfo->netfs_proto, "sshfs")) { 507 484 mr_asprintf(tmp1, "sshfs %s@%s", bkpinfo->netfs_user, bkpinfo->netfs_mount); 508 } else if (strstr(bkpinfo->netfs_proto, "smbfs")) {509 mr_asprintf(tmp1, "mount -t cifs %s -o user=%s", bkpinfo->netfs_mount, bkpinfo->netfs_user);510 485 } else if (strstr(bkpinfo->netfs_proto, "smbfs")) { 511 486 mr_asprintf(tmp1, "mount -t cifs %s -o user=%s", bkpinfo->netfs_mount, bkpinfo->netfs_user); … … 521 496 } else if (strstr(bkpinfo->netfs_proto, "smbfs")) { 522 497 mr_asprintf(tmp1, "mount -t cifs %s", bkpinfo->netfs_mount); 523 } else if (strstr(bkpinfo->netfs_proto, "smbfs")) {524 mr_asprintf(tmp1, "mount -t cifs %s", bkpinfo->netfs_mount);525 498 } else if (strstr(bkpinfo->netfs_proto, "nfs")) { 526 499 mr_asprintf(tmp1, "mount %s", bkpinfo->netfs_mount); … … 611 584 612 585 if (flag_set['E']) { 613 if (bkpinfo->exclude_paths && bkpinfo->exclude_paths[0] == '-') {586 if (bkpinfo->exclude_paths && (bkpinfo->exclude_paths[0] == '-')) { 614 587 retval++; 615 588 log_to_screen("Please supply a sensible value with '-E'\n"); … … 758 731 if (i) { 759 732 retval++; 760 log_to_screen( tmp2,"Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->netfs_remote_dir, bkpinfo->netfs_mount);733 log_to_screen("Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->netfs_remote_dir, bkpinfo->netfs_mount); 761 734 } 762 735 unlink(tmp1); … … 805 778 mr_free(tmp1); 806 779 } 807 mr_asprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768); 780 781 mr_asprintf(tmp1, "ln -sf %s/.foo.dat %s/.bar.dat", bkpinfo->scratchdir, bkpinfo->scratchdir); 782 if (run_program_and_log_output(tmp1, 1)) { 783 retval++; 784 mr_free(tmp1); 785 log_to_screen("Please don't specify a SAMBA or VFAT or NFS scratchdir."); 786 fatal_error("I cannot write to the scratchdir you specified."); 787 } 788 mr_free(tmp1); 808 789 } 809 790 … … 815 796 816 797 if (i) { 798 retval++; 817 799 log_to_screen("Please specify a tempdir which I can write to. :)"); 818 800 fatal_error("I cannot write to the tempdir you specified."); -
branches/3.1/mondo/src/common/libmondo-devices-EXT.h
r2715 r3190 48 48 extern char *list_of_NETFS_mounts_only(void); 49 49 50 extern void sensibly_set_scratchdir();51 52 53 50 extern char *set_dev_to_this_if_rx_OK(char *); 54 51 -
branches/3.1/mondo/src/common/libmondo-devices.c
r3161 r3190 50 50 extern char *g_selfmounted_isodir; 51 51 extern char *MONDO_LOGFILE; 52 53 extern void setup_tmpdir(char *path); 54 extern void setup_scratchdir(char *path); 52 55 53 56 static char g_cdrw_drive_is_here[MAX_STR_LEN / 4] = ""; … … 330 333 char *incoming = NULL; 331 334 char *searchstr = NULL; 335 char *tmp = NULL; 332 336 333 337 /*@ ints ******************************************************* */ … … 349 353 res = system(program); 350 354 mr_free(program); 351 return 355 return(res); 352 356 #endif 353 357 … … 400 404 assert_string_is_neither_NULL_nor_zerolength(str); 401 405 406 /* For UEFI detection, this should be extended to count=2 */ 402 407 mr_asprintf(command, "dd if=%s bs=446 count=1 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, str); 403 408 i = system(command); … … 845 850 tmp = call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep -E '\)\ \'' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1",TRUE); 846 851 log_msg(5, "tmp = '%s'", tmp); 847 if (!tmp[0]) 852 if (!tmp[0]) { 848 853 mr_free(tmp); 849 854 tmp = call_program_and_get_last_line_of_output("cdrecord -scanbus 2> /dev/null | grep \)\ \' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1",TRUE); 855 } 850 856 if (tmp[0]) { 851 857 devno = atoi(tmp) - 1; … … 1433 1439 1434 1440 if (g_ISO_restore_mode || bkpinfo->backup_media_type == iso || bkpinfo->backup_media_type == netfs) { 1435 // BERLIOS --- I'm tempted to do something about this...1436 // Why unmount and remount again and again?1437 1441 g_ISO_restore_mode = TRUE; 1438 if (!is_this_device_mounted(MNT_CDROM)) {1439 log_msg(3, "Mounting media");1440 g_current_media_number = cd_number_i_want;1441 mount_media();1442 }1443 1442 } 1444 1443 if ((res = what_number_cd_is_this()) != cd_number_i_want) { … … 1733 1732 log_msg (4, "Found partition: %s", token); 1734 1733 partitions[i++] = token; 1734 mr_free(token); 1735 1735 } 1736 1736 mr_asprintf(ndsf, "%s", dsf); … … 1939 1939 if ((DSFptr = find_device_in_list(token)) == NULL) { 1940 1940 log_msg (4, "Can't find device %s in mounted file systems list", token); 1941 mr_free(tmp); 1941 1942 mr_free(token); 1942 1943 return (1); … … 2734 2735 sz_size = p; 2735 2736 2736 for (i = 0; i <= MAX_NOOF_MEDIA; i++) { 2737 bkpinfo->media_size[i] = atoi(sz_size); 2738 } 2739 2740 if (bkpinfo->media_size[0] <= 0) { 2737 bkpinfo->media_size = atoi(sz_size); 2738 2739 if (bkpinfo->media_size <= 0) { 2741 2740 log_to_screen("User has chosen not to backup the PC"); 2742 2741 finish(1); … … 2804 2803 2805 2804 if (bkpinfo->backup_media_type == cdstream) { 2806 for (i = 0; i <= MAX_NOOF_MEDIA; i++) { 2807 bkpinfo->media_size[i] = 650; 2808 } 2805 bkpinfo->media_size = 650; 2809 2806 } 2810 2807 break; … … 2866 2863 bkpinfo->media_size[0] = 0; 2867 2864 } 2868 for (i = 1; i <= MAX_NOOF_MEDIA; i++) { 2869 bkpinfo->media_size[i] = bkpinfo->media_size[0]; 2870 } 2865 2866 bkpinfo->media_size = 0; 2867 log_msg(4, "media_size = %ld", bkpinfo->media_size); 2868 2871 2869 bkpinfo->use_obdr = ask_me_yes_or_no 2872 2870 ("Do you want to activate OBDR support for your tapes ?"); … … 2960 2958 mr_asprintf(sz_size, "0"); 2961 2959 } 2962 for (i = 0; i <= MAX_NOOF_MEDIA; i++) { 2963 bkpinfo->media_size[i] = atoi(sz_size); 2964 } 2960 bkpinfo->media_size = atoi(sz_size); 2965 2961 mr_free(sz_size); 2966 if (bkpinfo->media_size[0] < 0) { 2962 2963 if (bkpinfo->media_size < 0) { 2967 2964 log_to_screen("User has chosen not to backup the PC"); 2968 2965 finish(1); … … 3172 3169 } 3173 3170 bkpinfo->boot_loader = i; 3171 3174 3172 mr_free(bkpinfo->include_paths); 3175 3173 mr_asprintf(p, "/"); … … 3237 3235 mr_asprintf(g_getfacl,"getfacl"); 3238 3236 } 3237 log_it("Backup of extended attributes"); 3239 3238 } 3240 3239 // Interactive mode: … … 3302 3301 3303 3302 log_it("media device = %s", bkpinfo->media_device); 3304 log_it("media size = %ld", bkpinfo->media_size [1]);3303 log_it("media size = %ld", bkpinfo->media_size); 3305 3304 tmp = bkptype_to_string(bkpinfo->backup_media_type); 3306 3305 log_it("media type = %s", tmp); … … 3316 3315 /* Handle devices passed in bkpinfo and print result */ 3317 3316 /* the mr_make_devlist_from_pathlist function appends 3318 * to the *_paths variables so copy before */ 3319 mr_asprintf(tmp, "%s|", bkpinfo->exclude_paths); 3320 mr_make_devlist_from_pathlist(tmp, 'E'); 3321 mr_free(tmp); 3322 mr_asprintf(tmp, "%s|", bkpinfo->include_paths); 3323 mr_make_devlist_from_pathlist(tmp, 'I'); 3324 mr_free(tmp); 3317 /* to the *_paths variables so copy before */ 3318 mr_make_devlist_from_pathlist(bkpinfo->exclude_paths, 'E'); 3319 mr_make_devlist_from_pathlist(bkpinfo->include_paths, 'I'); 3325 3320 3326 3321 log_it("scratchdir = '%s'", bkpinfo->scratchdir); … … 3330 3325 } 3331 3326 log_it("boot_device = '%s' (loader=%c)", bkpinfo->boot_device, bkpinfo->boot_loader); 3332 if (bkpinfo->media_size [0]< 0) {3327 if (bkpinfo->media_size < 0) { 3333 3328 if (archiving_to_media) { 3334 3329 fatal_error("Media size is less than zero."); 3335 3330 } else { 3336 3331 log_msg(2, "Warning - media size is less than zero."); 3337 bkpinfo->media_size [0]= 0;3332 bkpinfo->media_size = 0; 3338 3333 } 3339 3334 } -
branches/3.1/mondo/src/common/libmondo-devices.h
r2715 r3190 40 40 char *list_of_NETFS_mounts_only(); 41 41 42 void sensibly_set_scratchdir();43 44 45 42 char *set_dev_to_this_if_rx_OK(char *dev); 46 43 -
branches/3.1/mondo/src/common/libmondo-filelist.c
r3161 r3190 29 29 30 30 31 extern ssize_t getline(char **lineptr, size_t * n, FILE * stream); 31 32 extern char *MONDO_LOGFILE; 32 33 … … 451 452 } 452 453 log_msg(8, "Analyzing %s", file_to_analyze); 453 tmp = mr_stresc(file_to_analyze, " `$\\\"(){}[]'*?&|!#~", '\\');454 mr_asprintf(s trtmp, syscall_sprintf, tmp);454 tmp = mr_stresc(file_to_analyze, "'", '\\', '\''); 455 mr_asprintf(syscall, "%s '%s' 2>> /dev/null", syscall_sprintf, tmp); // " MONDO_LOGFILE); 455 456 mr_free(tmp); 456 457 mr_asprintf(syscall, "%s 2>> /dev/null", strtmp); // " MONDO_LOGFILE);458 mr_free(strtmp);459 460 457 log_msg(20,"calling %s\n",syscall); 461 458 call_exe_and_pipe_output_to_fd(syscall, pout); … … 480 477 mr_free(command); 481 478 482 retval = 483 gen_aux_list(filelist, "getfacl --all-effective -P \"%s\"", facl_fname); 479 retval = gen_aux_list(filelist, "getfacl --all-effective -P ", facl_fname); 484 480 } 485 481 return (retval); … … 496 492 run_program_and_log_output(command, 8); 497 493 mr_free(command); 498 retval = 499 gen_aux_list(filelist, "getfattr --en=hex -m - -h -d \"%s\"", fattr_fname); 494 retval = gen_aux_list(filelist, "getfattr --en=hex -m - -h -d ", fattr_fname); 500 495 } 501 496 return (retval); … … 1338 1333 1339 1334 /* dir is needed when we pass it to the shell */ 1340 dir = mr_stresc(dir1, " `$\\\"(){}'[]&*?|!#~", '\\');1335 dir = mr_stresc(dir1, "'", '\\', '\''); 1341 1336 p = strrchr(dir1, '/'); 1342 1337 if (p) { … … 1346 1341 } 1347 1342 } 1348 mr_asprintf(find_excludes, " |");1343 mr_asprintf(find_excludes, " "); 1349 1344 1350 1345 if (!depth) { 1351 mr_asprintf(find_excludes, "|");1352 1346 if (sth != NULL) { 1353 while((token = mr_strtok(sth, delims, &lastpos)) ) {1347 while((token = mr_strtok(sth, delims, &lastpos)) != NULL) { 1354 1348 mr_strcat(find_excludes," -path %s -prune -o", token); 1355 1349 mr_free(token); … … 1365 1359 #if linux 1366 1360 // 2.6 has /sys as a proc-type thing -- must be excluded 1367 mr_asprintf(strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o fstype devtmpfs -prune -o -fstype proc -prune -o -fstype selinuxfs -prune -o -fstype securityfs -prune -o -fstype hugetlbfs -o -fstype cgroup -prune -prune -o -fstype mqueue -prune -o -fstype debugfs -prune -o -fstype sysfs -prune -o -fstype rpc_pipefs -prune -o -fstype none -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);1361 mr_asprintf(strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype devtmpfs -prune -o -fstype proc -prune -o -fstype selinuxfs -prune -o -fstype securityfs -prune -o -fstype hugetlbfs -o -fstype cgroup -prune -prune -o -fstype mqueue -prune -o -fstype debugfs -prune -o -fstype sysfs -prune -o -fstype rpc_pipefs -prune -o -fstype none -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist); 1368 1362 #else 1369 1363 // On BSD, for example, /sys is the kernel sources -- don't exclude … … 1422 1416 // log_msg(0, "Cataloguing %s", dir); 1423 1417 mr_asprintf(skip_these, "|%s|", sth); 1418 1424 1419 mr_asprintf(new_with_pipe, "|%s|", dir1); 1425 1420 if ((dip = opendir(dir1)) == NULL) { … … 1441 1436 } 1442 1437 mr_free(new_with_pipe); 1438 mr_asprintf(new_with_pipe, "|%s|", new); 1443 1439 if (strstr(skip_these, new_with_pipe)) { 1444 1440 fprintf(fout, "%s\n", new); … … 1493 1489 1494 1490 1495 1496 1491 /** 1497 1492 * Create the filelist for the backup. It will be stored in [scratchdir]/archives/filelist.full. … … 1592 1587 mr_asprintf(g_skeleton_filelist, "%s/tmpfs/skeleton.txt", bkpinfo->tmpdir); 1593 1588 make_hole_for_file(g_skeleton_filelist); 1589 1594 1590 log_msg(4, "g_skeleton_entries = %ld", g_skeleton_entries); 1595 1591 log_msg(2, "Opening out filelist to %s", sz_filelist); … … 1597 1593 fatal_error("Cannot openout to sz_filelist"); 1598 1594 } 1599 if (( !include_paths) ||(strlen(include_paths) == 0)) {1595 if ((include_paths != NULL) && (strlen(include_paths) == 0)) { 1600 1596 log_msg(1, "Including only '/' in %s", sz_filelist); 1601 1597 open_and_list_dir("/", exclude_paths, fout, … … 1668 1664 1669 1665 if (bkpinfo->make_filelist) { 1670 res = 1671 mondo_makefilelist(MONDO_LOGFILE, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL); 1666 res = mondo_makefilelist(MONDO_LOGFILE, bkpinfo->include_paths, bkpinfo->exclude_paths, bkpinfo->differential, NULL); 1672 1667 } else { 1673 res = 1674 mondo_makefilelist(MONDO_LOGFILE, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths); 1668 res = mondo_makefilelist(MONDO_LOGFILE, NULL, bkpinfo->exclude_paths, bkpinfo->differential, bkpinfo->include_paths); 1675 1669 } 1676 1670 … … 1799 1793 } 1800 1794 log_msg(5, "Found '%s'", fname); 1801 tmp = mr_stresc(fname, "[]*?", '\\' );1795 tmp = mr_stresc(fname, "[]*?", '\\', "'"); 1802 1796 mr_free(fname); 1803 1797 fname = tmp; -
branches/3.1/mondo/src/common/libmondo-files.c
r3161 r3190 145 145 fin = popen(command, "r"); 146 146 mr_free(command); 147 147 148 if (fin) { 148 149 if (feof(fin)) { … … 216 217 assert_string_is_neither_NULL_nor_zerolength(inout); 217 218 mr_asprintf(infname, "%s.in", inout); 218 mr_asprintf(outfname, "%s", inout);219 219 mr_asprintf(tmp, "cp -f %s %s", inout, infname); 220 220 run_program_and_log_output(tmp, FALSE); … … 226 226 return; 227 227 } 228 229 mr_asprintf(outfname, "%s", inout); 228 230 if (!(fout = fopen(outfname, "w"))) { 229 231 log_OS_error("Unable to openout outfname"); 232 mr_free(infname); 230 233 mr_free(outfname); 231 234 return; … … 252 255 mr_free(infname); 253 256 } 254 255 256 257 258 259 260 261 257 262 258 … … 271 267 272 268 char *tmp = NULL; 273 char *command = NULL; ;274 char *kernel = NULL; ;269 char *command = NULL; 270 char *kernel = NULL; 275 271 276 272 kernel = call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null",TRUE); … … 308 304 309 305 310 311 312 313 314 306 /** 315 307 * Find location of specified executable in user's PATH. … … 358 350 return (output); 359 351 } 360 361 362 363 364 365 366 352 367 353 … … 659 645 return (0); 660 646 } 661 662 663 647 664 648 … … 1028 1012 fatal_error("Failed to copy LAST-FILELIST-NUMBER to scratchdir"); 1029 1013 } 1014 mr_free(command); 1030 1015 1031 1016 tmp = call_program_and_get_last_line_of_output("which mondorestore",TRUE); … … 1099 1084 1100 1085 /* BERLIOS : there is a bug #67 here as it only considers the first NIC */ 1101 mr_asprintf(command, " ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1");1086 mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1"); 1102 1087 netfs_dev = call_program_and_get_last_line_of_output(command,TRUE); 1103 1088 mr_free(command); … … 1119 1104 mr_free(command); 1120 1105 1106 mr_asprintf(command, "ifconfig %s | head -1 | awk '{print $5}'", netfs_dev); 1107 netfs_client_hwaddr = call_program_and_get_last_line_of_output(command); 1108 mr_free(command); 1109 1110 log_it("netfs_client_hwaddr=%s; netfs_client_ipaddr=%s; netfs_server_ipaddr=%s; netfs_mount=%s", netfs_client_hwaddr, netfs_client_ipaddr, netfs_server_ipaddr, netfs_mount); 1121 1111 if (strlen(netfs_dev) < 2) { 1122 1112 fatal_error("Unable to find ethN (eth0, eth1, ...) adapter via Network mount you specified."); … … 1124 1114 1125 1115 /******** 1126 * If the Network device thatfound above is a bonded device,1116 * If the Network device found above is a bonded device, 1127 1117 * we need to replace it with an ethN device or the 1128 1118 * networking will not start during an Network restore. … … 1153 1143 mr_free(tmp); 1154 1144 1155 mr_asprintf(tmp, "%s/NETFS- SERVER-MOUNT", bkpinfo->tmpdir);1156 write_one_liner_data_file(tmp, bkpinfo->netfs_mount);1157 mr_free( tmp);1158 mr_free( netfs_mount);1145 mr_asprintf(tmp, "%s/NETFS-CLIENT-HWADDR", bkpinfo->tmpdir); 1146 write_one_liner_data_file(tmp, netfs_client_hwaddr); 1147 mr_free(netfs_client_hwaddr); 1148 mr_free(tmp); 1159 1149 1160 1150 mr_asprintf(tmp, "%s/NETFS-CLIENT-IPADDR", bkpinfo->tmpdir); 1161 1151 write_one_liner_data_file(tmp, netfs_client_ipaddr); 1162 mr_free(tmp); 1163 1164 mr_asprintf(tmp, "%s/NETFS-CLIENT-HWADDR", bkpinfo->tmpdir); 1165 write_one_liner_data_file(tmp, netfs_client_hwaddr); 1152 mr_free(netfs_client_ipaddr); 1166 1153 mr_free(tmp); 1167 1154 1168 1155 mr_asprintf(tmp, "%s/NETFS-CLIENT-NETMASK", bkpinfo->tmpdir); 1169 1156 write_one_liner_data_file(tmp, netfs_client_netmask); 1157 mr_free(netfs_client_netmask); 1170 1158 mr_free(tmp); 1171 1159 1172 1160 mr_asprintf(tmp, "%s/NETFS-CLIENT-BROADCAST", bkpinfo->tmpdir); 1173 1161 write_one_liner_data_file(tmp, netfs_client_broadcast); 1162 mr_free(netfs_client_broadcast); 1174 1163 mr_free(tmp); 1175 1164 1176 1165 mr_asprintf(tmp, "%s/NETFS-CLIENT-DEFGW", bkpinfo->tmpdir); 1177 1166 write_one_liner_data_file(tmp, netfs_client_defgw); 1167 mr_free(netfs_client_defgw); 1178 1168 mr_free(tmp); 1179 1169 1180 1170 mr_asprintf(tmp, "%s/NETFS-SERVER-IPADDR", bkpinfo->tmpdir); 1181 1171 write_one_liner_data_file(tmp, netfs_server_ipaddr); 1172 mr_free(netfs_server_ipaddr); 1182 1173 mr_free(tmp); 1183 1174 … … 1198 1189 write_one_liner_data_file(tmp, bkpinfo->prefix); 1199 1190 mr_free(tmp); 1191 1192 sprintf(tmp, "%s/NETFS-PROTO", bkpinfo->tmpdir); 1193 write_one_liner_data_file(tmp, bkpinfo->netfs_proto); 1194 mr_free(tmp); 1195 1200 1196 1201 1197 log_it("Finished storing Network configuration"); … … 1228 1224 long long scratchLL; 1229 1225 1230 if (bkpinfo->media_size [1]<= 0) {1226 if (bkpinfo->media_size <= 0) { 1231 1227 log_to_screen("Number of media required: UNKNOWN"); 1232 1228 return; … … 1234 1230 1235 1231 log_it("Estimating number of media required..."); 1236 scratchLL = 1237 (long long) (noof_sets) * (long long) (bkpinfo->optimal_set_size) 1238 + (long long) (size_of_all_biggiefiles_K()); 1239 scratchLL = (scratchLL / 1024) / bkpinfo->media_size[1]; 1232 scratchLL = (long long) (noof_sets) * (long long) (bkpinfo->optimal_set_size) + (long long) (size_of_all_biggiefiles_K()); 1233 scratchLL = (scratchLL / 1024) / bkpinfo->media_size; 1240 1234 scratchLL++; 1241 1235 if (bkpinfo->use_lzo) { -
branches/3.1/mondo/src/common/libmondo-fork.c
r3161 r3190 123 123 char *cd_number_str = NULL; 124 124 char *command = NULL; 125 char *p ;125 char *p= NULL; 126 126 char *tmp1 = NULL; 127 127 char *tmp2 = NULL; … … 140 140 141 141 mr_asprintf(cd_number_str, "%d", cd_no); 142 midway_call = resolve_naff_tokens(tmp1, isofile, "_ISO_"); 142 143 log_msg(4, "basic call = '%s'", tmp1); 143 midway_call = resolve_naff_tokens(tmp1, isofile, "_ISO_");144 144 mr_free(tmp1); 145 145 146 tmp = resolve_naff_tokens(midway_call, cd_number_str, "_CD#_"); 146 147 log_msg(4, "midway_call = '%s'", midway_call); 147 tmp = resolve_naff_tokens(midway_call, cd_number_str, "_CD#_");148 148 mr_free(cd_number_str); 149 149 mr_free(midway_call); 150 150 151 log_msg(4, "tmp = '%s'", tmp);152 151 ultimate_call = resolve_naff_tokens(tmp, MONDO_LOGFILE, "_ERR_"); 152 log_msg(4, "ultimate call = '%s'", ultimate_call); 153 153 mr_free(tmp); 154 154 155 log_msg(4, "ultimate call = '%s'", ultimate_call);156 155 mr_asprintf(command, "%s >> %s", ultimate_call, MONDO_LOGFILE); 157 156 mr_free(ultimate_call); 158 157 159 log_to_screen 160 ("Please be patient. Do not be alarmed by on-screen inactivity."); 161 log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'", 162 what_i_am_doing); 158 log_to_screen("Please be patient. Do not be alarmed by on-screen inactivity."); 159 log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'", what_i_am_doing); 163 160 if (bkpinfo->manual_cd_tray) { 164 161 mr_asprintf(tmp2, "%s", command); 165 162 p = strstr(tmp2, "2>>"); 166 163 if (p) { 167 *p++ = ' '; 168 *p++ = ' '; 169 *p++ = ' '; 164 sprintf(p, " "); 170 165 while (*p == ' ') { 171 166 p++; … … 376 371 return (1); 377 372 } 378 mr_free(command);379 373 380 374 if (!does_file_exist(lockfile)) { … … 384 378 } 385 379 } 380 mr_free(command); 386 381 387 382 for (; does_file_exist(lockfile); sleep(1)) { … … 535 530 bytes_to_be_read = atol(tmp1); 536 531 } 532 } 533 534 if (direction == 'w') { 535 mr_asprintf(tmp, "%-64s", PIMP_END_SZ); 536 if (fwrite(tmp, 1, 64, fout) != 64) { 537 mr_free(tmp); 538 fatal_error("Can't write the final block"); 539 } 540 mr_free(tmp); 541 } else { 537 542 log_msg(1, "tmpA is %s", tmp1); 538 543 if (!strstr(tmp1, PIMP_END_SZ)) { … … 554 559 } 555 560 556 sprintf(tmp, "I am here - %lld", (long long)ftello(fin));561 mr_asprintf(tmp, "I am here - %lld", (long long)ftello(fin)); 557 562 if (fread(tmp, 1, tmpcap, fin)) { 563 mr_free(tmp); 558 564 fatal_error("Can't fread here"); 559 565 } 560 566 log_msg(0, "tmp = '%s'", tmp); 561 567 if (fwrite(tmp, 1, tmpcap, ftmp)) { 568 mr_free(tmp); 562 569 fatal_error("Can't fwrite there"); 563 570 } 564 571 fclose(ftmp); 565 mr_free(tmp 1);572 mr_free(tmp); 566 573 fatal_error("Missing terminating block"); 567 574 } 568 575 } 569 mr_free(tmp1);570 }576 } 577 mr_free(tmp1); 571 578 572 579 paranoid_free(buf); … … 595 602 command = find_home_of_exe("ntfsclone"); 596 603 if (!command) { 597 mr_free(command);598 604 fatal_error("ntfsclone not found"); 599 605 } … … 641 647 /*@ buffers *********************************************************** */ 642 648 char *command = NULL; 643 char *title = NULL;644 649 /*@ pointers ********************************************************** */ 645 650 static int chldres = 0; … … 659 664 660 665 log_msg(8, "Parent running"); 661 mr_asprintf(title, "%s", tt); 662 open_evalcall_form(title); 663 mr_free(title); 666 open_evalcall_form(tt); 664 667 665 668 for (sleep(1); command[0] != '\0'; sleep(1)) { … … 672 675 if (pcno <= 5 && last_pcno >= 40) { 673 676 close_evalcall_form(); 674 mr_asprintf(title, "Verifying..."); 675 open_evalcall_form(title); 676 mr_free(title); 677 open_evalcall_form("Verifying..."); 677 678 } 678 679 if (counter++ >= 5) { -
branches/3.1/mondo/src/common/libmondo-mountlist.c
r3161 r3190 587 587 588 588 /* Look for duplicate mountpoints in mountlist. */ 589 590 589 for (currline = 0; currline < mountlist->entries; currline++) { 591 590 mr_asprintf(curr_mountpoint, "%s", mountlist->el[currline].mountpoint); … … 743 742 for (i = 0; i < mountlist->entries; i++) { 744 743 if (strstr(mountlist->el[i].mountpoint, "raid")) { 745 used_by = which_raid_device_is_using_this_partition(raidlist, 746 mountlist->el[i]. 747 device); 744 used_by = which_raid_device_is_using_this_partition(raidlist, mountlist->el[i].device); 748 745 if (used_by < 0) { 749 746 memcpy((void *) &output_list->el[items++], -
branches/3.1/mondo/src/common/libmondo-raid.c
r3161 r3190 1233 1233 row++; 1234 1234 } 1235 // free string1236 mr_free(string);1235 // free string 1236 mr_free(string); 1237 1237 } 1238 1238 // close file -
branches/3.1/mondo/src/common/libmondo-stream.c
r3161 r3190 193 193 } 194 194 if (should_we_write_to_next_tape 195 (bkpinfo->media_size [g_current_media_number], (off_t)256 * 1024)) {195 (bkpinfo->media_size, (off_t)256 * 1024)) { 196 196 start_to_write_to_next_tape(); 197 197 } … … 206 206 { 207 207 fwrite (blk, 1, 256*1024, g_tape_stream); 208 if (should_we_write_to_next_tape (bkpinfo->media_size [g_current_media_number], 256*1024))208 if (should_we_write_to_next_tape (bkpinfo->media_size, 256*1024)) 209 209 { 210 210 start_to_write_to_next_tape (); … … 278 278 mr_asprintf(dev, "%s", VANILLA_SCSI_TAPE); 279 279 mr_free(tmp); 280 mr_free(cdr_exe); 280 281 return(dev); 281 282 } … … 288 289 if (strlen(tmp) < 2) { 289 290 log_it("Could not find tape device"); 291 mr_free(cdr_exe); 290 292 mr_free(tmp); 291 293 return(NULL); … … 295 297 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe); 296 298 mr_free(cdr_exe); 299 297 300 tmp = call_program_and_get_last_line_of_output(command,TRUE); 298 301 mr_free(command); … … 812 815 log_to_screen("Reading stream"); 813 816 log_it("stream device = '%s'", bkpinfo->media_device); 814 /* skip data disks */817 /* skip data disks */ 815 818 open_evalcall_form("Skipping data disks on stream"); 816 819 log_to_screen("Skipping data disks on stream"); … … 937 940 } 938 941 if (bkpinfo->media_device == NULL) { 939 log_it("Unable to openout NULL d vice");942 log_it("Unable to openout NULL device"); 940 943 return(1); 941 944 } … … 1305 1308 char *pA; 1306 1309 char *pB; 1310 int res; 1307 1311 int ctrl_chr; 1308 int res;1309 1312 char *temp_fname; 1310 1313 char *datablock; … … 1325 1328 while (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 1326 1329 res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr); 1330 if (res) { 1331 // FIXME 1332 } 1327 1333 if (ctrl_chr == BLK_START_AN_AFIO_OR_SLICE) { 1328 1334 break; … … 1472 1478 log_it("New tape requested."); 1473 1479 insist_on_this_tape_number(g_current_media_number + 1); // will increment g_current_media, too 1474 if (g_current_media_number > MAX_NOOF_MEDIA) {1475 res++;1476 log_to_screen("Too many tapes. Man, you need to use nfs!");1477 }1478 1480 if (bkpinfo->backup_media_type == cdstream) { 1479 1481 mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE, MONDO_LOGFILE); … … 1663 1665 filesize = length_of_file(infile); 1664 1666 if (should_we_write_to_next_tape 1665 (bkpinfo->media_size [g_current_media_number], filesize)) {1667 (bkpinfo->media_size, filesize)) { 1666 1668 start_to_write_to_next_tape(); 1667 1669 write_backcatalog_to_tape(); -
branches/3.1/mondo/src/common/libmondo-string.c
r3147 r3190 141 141 142 142 143 144 145 146 147 148 149 150 143 /** 151 144 * Turn an entry from the RAID editor's disklist into a GUI-friendly string. … … 186 179 long outval; 187 180 int i; 188 char *tmp 1= NULL;181 char *tmp = NULL; 189 182 char ch; 190 183 … … 198 191 } 199 192 200 mr_asprintf(tmp 1, "%s", incoming);201 i = (int) strlen(tmp 1);202 if (tmp 1[i - 1] == 'B' || tmp1[i - 1] == 'b') {203 tmp 1[i - 1] = '\0';204 } 205 for (i = 0; i < (int) strlen(tmp 1) && isdigit(tmp1[i]); i++);206 ch = tmp 1[i];207 tmp 1[i] = '\0';208 outval = atol(tmp 1);209 paranoid_free(tmp1);193 mr_asprintf(tmp, "%s", incoming); 194 i = (int) strlen(tmp); 195 if (tmp[i - 1] == 'B' || tmp[i - 1] == 'b') { 196 tmp[i - 1] = '\0'; 197 } 198 for (i = 0; i < (int) strlen(tmp) && isdigit(tmp[i]); i++); 199 ch = tmp[i]; 200 tmp[i] = '\0'; 201 outval = atol(tmp); 202 mr_free(tmp); 210 203 211 204 if (ch == 'g' || ch == 'G') { … … 224 217 fatal_error("Integer overflow."); 225 218 } else if (ch != 'm' && ch != 'M') { 226 mr_asprintf(tmp 1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch);227 fatal_error(tmp 1);219 mr_asprintf(tmp, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch); 220 fatal_error(tmp); 228 221 } 229 222 return (outval); … … 1043 1036 assert(bkpinfo != NULL); 1044 1037 1045 if (bkpinfo->media_size [g_current_media_number]<= 0) {1038 if (bkpinfo->media_size <= 0) { 1046 1039 mr_asprintf(tmp, "%lld", g_tape_posK); 1047 1040 mr_asprintf(pos_w_commas, "%s", commarize(tmp)); … … 1052 1045 } 1053 1046 1054 /* update screen */1047 /* update screen */ 1055 1048 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1056 percentage = 1057 (int) (g_tape_posK / 10 / 1058 bkpinfo->media_size[g_current_media_number]); 1049 percentage = (int) (g_tape_posK / 10 / bkpinfo->media_size); 1059 1050 if (percentage > 100) { 1060 1051 percentage = 100; … … 1062 1053 mr_asprintf(outstr, "Volume %d: [", g_current_media_number); 1063 1054 } else { 1064 percentage = 1065 (int) (space_occupied_by_cd(bkpinfo->scratchdir) * 100 / 1024 / 1066 bkpinfo->media_size[g_current_media_number]); 1055 percentage = (int) (space_occupied_by_cd(bkpinfo->scratchdir) * 100 / 1024 / bkpinfo->media_size); 1067 1056 mds = media_descriptor_string(bkpinfo->backup_media_type); 1068 1057 mr_asprintf(outstr, "%s %d: [", mds, g_current_media_number); -
branches/3.1/mondo/src/common/libmondo-tools-EXT.h
r2508 r3190 3 3 extern void clean_up_KDE_desktop_if_necessary(void); 4 4 extern long get_time(); 5 extern char *mr_date(void); 5 6 extern void (*log_debug_msg) (int debug_level, const char *szFile, 6 7 const char *szFunction, int nLine, -
branches/3.1/mondo/src/common/libmondo-tools.c
r3161 r3190 57 57 */ 58 58 char *g_mondo_home = NULL; 59 60 /** 61 * The serial string (used to differentiate between backups) of the current backup. 62 */ 63 char *g_serial_string = NULL; 59 64 60 65 /** … … 363 368 assert(bkpinfo != NULL); 364 369 365 if (!bkpinfo->tmpdir) {366 fatal_error("Tmpdir set to NULL !");367 }368 369 370 bkpinfo->optimal_set_size = 370 371 (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type) ? 16 : 16) * 371 372 1024; 372 373 if (strlen(bkpinfo->tmpdir) < 2) {374 log_it("tmpdir is blank/missing");375 retval++;376 }377 373 378 374 log_msg(1, "Post-param"); … … 393 389 } 394 390 mr_free(tmp); 395 }396 if (bkpinfo->scratchdir) {397 make_hole_for_dir(bkpinfo->scratchdir);398 chmod(bkpinfo->scratchdir, 0700);399 } else {400 fatal_error("Scratchdir set to NULL !");401 391 } 402 392 if (bkpinfo->backup_media_type == iso) … … 461 451 } 462 452 #endif 463 else 464 { 453 else { 465 454 mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX); 466 455 } 467 456 if (bkpinfo->manual_cd_tray) { 468 paranoid_free(mondo_mkisofs_sz);469 457 fatal_error("Manual CD tray + DVD not supported yet."); 470 458 // -m isn't supported by growisofs, BTW... 471 } else { 472 if (bkpinfo->media_device == NULL) { 473 return(1); 474 } 459 } else {} 475 460 mr_free(bkpinfo->call_make_iso); 476 461 mr_asprintf(bkpinfo->call_make_iso, "%s %s -Z %s . 2>> _ERR_", mondo_mkisofs_sz, "", bkpinfo->media_device); 477 paranoid_free(mondo_mkisofs_sz);478 }462 } 463 mr_free(mondo_mkisofs_sz); 479 464 if (getenv ("SUDO_COMMAND")) { 480 465 mr_asprintf(command, "strings `which growisofs` | grep -c SUDO_COMMAND"); … … 506 491 } 507 492 if (find_home_of_exe("cdrecord")) { 508 strcpy(cdr_exe, "cdrecord");493 mr_asprintf(cdr_exe, "cdrecord"); 509 494 } else if (find_home_of_exe("dvdrecord")) { 510 strcpy(cdr_exe, "dvdrecord");495 mr_asprintf(cdr_exe, "dvdrecord"); 511 496 } else { 512 497 mr_free(tmp); … … 569 554 } 570 555 mr_free(cdr_exe); 571 paranoid_free(mondo_mkisofs_sz);572 paranoid_free(extra_cdrom_params);556 mr_free(mondo_mkisofs_sz); 557 mr_free(extra_cdrom_params); 573 558 } // end of CD code 574 559 … … 587 572 iso_dev = call_program_and_get_last_line_of_output(command,TRUE); 588 573 log_it("res of it = %s", iso_dev); 574 mr_asprintf(tmp, "%s/ISO-DEV", bkpinfo->tmpdir); 575 write_one_liner_data_file(tmp, iso_dev); 576 mr_free(tmp); 589 577 mr_free(command); 590 578 … … 595 583 iso_mnt = call_program_and_get_last_line_of_output(command,TRUE); 596 584 log_it("res of it = %s", iso_mnt); 585 mr_asprintf(tmp, "%s/ISO-MNT", bkpinfo->tmpdir); 586 write_one_liner_data_file(tmp, iso_mnt); 587 mr_free(tmp); 597 588 mr_free(command); 598 589 … … 602 593 mr_asprintf(iso_path, "%s", ""); 603 594 } else { 604 // If iso_mnt is only / then iso_path is the full dir 595 // If iso_mnt is only / then iso_path is the full dir 605 596 // (the formula bellow doesn't work in this case) 606 597 if (strcmp(iso_mnt, "/") == 0) { … … 614 605 mr_free(iso_tmp); 615 606 607 mr_asprintf(tmp, "%s/ISODIR", bkpinfo->tmpdir); 608 write_one_liner_data_file(tmp, iso_path); 609 mr_free(tmp); 610 616 611 log_it("isodir: %s", iso_path); 617 612 mr_free(iso_path); 613 614 mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir); 615 write_one_liner_data_file(tmp, bkpinfo->prefix); 616 mr_free(tmp); 618 617 619 618 log_it("iso-prefix: %s", bkpinfo->prefix); … … 666 665 } 667 666 if (bkpinfo->include_paths == NULL) { 668 mr_asprintf(p, "/"); 669 bkpinfo->include_paths = p; 667 mr_asprintf(bkpinfo->include_paths, "/"); 670 668 } 671 669 g_backup_media_type = bkpinfo->backup_media_type; … … 731 729 if ((bkpinfo->tmpdir != NULL) && (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL)) { 732 730 /* purging a potential old tmpdir */ 733 log_it("Purging old tmpdir %s", bkpinfo->tmpdir);734 731 if (chdir("/tmp")) { 735 732 // FIXME … … 757 754 finish(-1); 758 755 } 759 760 756 bkpinfo->tmpdir = p; 761 757 log_it("bkpinfo->tmpdir is being set to %s", bkpinfo->tmpdir); 758 759 mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir); 760 paranoid_system(tmp); 761 mr_free(tmp); 762 } 763 764 765 void setup_scratchdir(char *path) { 766 767 char *tmp = NULL; 768 char *p = NULL; 769 770 if (bkpinfo->scratchdir != NULL) { 771 /* purging a potential old scratchdir */ 772 if (chdir("/tmp")) { 773 // FIXME 774 } 775 if (strstr(bkpinfo->scratchdir,"mondo.scratch.") != NULL) { 776 log_it("Purging old scratchdir %s", bkpinfo->scratchdir); 777 mr_asprintf(tmp,"rm -Rf %s",bkpinfo->scratchdir); 778 } else { 779 log_it("Purging old scratchdir %s/mondo.scratch.*", bkpinfo->scratchdir); 780 mr_asprintf(tmp,"rm -Rf %s/mondo.scratch.*",bkpinfo->scratchdir); 781 } 782 paranoid_system(tmp); 783 mr_free(tmp); 784 } 785 786 /* Always take in account arg first, then env, then default */ 787 if (path != NULL) { 788 mr_asprintf(tmp, "%s/mondo.scratch.XXXXXX", path); 789 } else if (getenv("MRSCRATCH")) { 790 mr_asprintf(tmp, "%s/mondo.scratch.XXXXXX", getenv("MRSCRATCH")); 791 } else { 792 mr_asprintf(tmp, "/tmp/mondo.scratch.XXXXXX"); 793 } 794 p = mkdtemp(tmp); 795 if (p == NULL) { 796 log_it("Failed to create global scratch directory %s for Mondo.",tmp); 797 finish(-1); 798 } 799 strcpy(bkpinfo->scratchdir,p); 800 log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir); 801 paranoid_free(tmp); 802 803 mr_asprintf(tmp, "mkdir -p %s", bkpinfo->scratchdir); 804 paranoid_system(tmp); 805 mr_free(tmp); 762 806 } 763 807 … … 805 849 bkpinfo = (struct s_bkpinfo *)mr_malloc(sizeof(struct s_bkpinfo)); 806 850 807 /* We need tmpdir as early as possible for further function calls */808 bkpinfo->tmpdir = NULL; // Really setup after809 setup_tmpdir(NULL);810 811 851 /* Initialized in same order as in the structure declaration to detect errors more easily */ 812 852 bkpinfo->media_device = NULL; 813 for (i = 0; i <= MAX_NOOF_MEDIA; i++) { 814 bkpinfo->media_size[i] = -1; 815 } 853 bkpinfo->media_size = -1; 816 854 bkpinfo->boot_loader = '\0'; 817 855 bkpinfo->boot_device = NULL; … … 828 866 bkpinfo->use_star = FALSE; 829 867 bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE; 868 869 /* We need tmpdir as early as possible for further function calls */ 870 bkpinfo->tmpdir = NULL; // Really setup after 871 setup_tmpdir(NULL); 872 setup_scratchdir(NULL); 873 830 874 bkpinfo->disaster_recovery = am_I_in_disaster_recovery_mode(); 831 875 if (bkpinfo->disaster_recovery) { … … 835 879 } 836 880 mr_asprintf(bkpinfo->prefix, "%s", STD_PREFIX); 837 /* bkpinfo->tmpdir is here in the struct */838 bkpinfo->scratchdir = NULL; // Really setup after839 881 bkpinfo->optimal_set_size = 0; 840 882 bkpinfo->backup_media_type = none; 841 883 bkpinfo->make_filelist = TRUE; // unless -J supplied to mondoarchive 884 bkpinfo->exclude_paths = NULL; 842 885 bkpinfo->include_paths = NULL; 843 bkpinfo->exclude_paths = NULL;844 886 bkpinfo->exclude_devs = NULL; 845 887 bkpinfo->restore_path = NULL; … … 850 892 bkpinfo->kernel_path = NULL; 851 893 bkpinfo->netfs_mount = NULL; 894 bkpinfo->netfs_proto = NULL; 895 bkpinfo->netfs_user = NULL; 852 896 bkpinfo->netfs_remote_dir = NULL; 853 bkpinfo->netfs_user = NULL;854 bkpinfo->netfs_proto = NULL;855 897 bkpinfo->postnuke_tarball = NULL; 856 898 bkpinfo->subdir = NULL; … … 864 906 bkpinfo->use_obdr = FALSE; 865 907 bkpinfo->restore_mode = interactive; 866 867 sensibly_set_scratchdir(); 868 } 869 870 908 } 871 909 872 910 … … 1218 1256 mr_asprintf(command, "mount | grep -Ew '/boot'"); 1219 1257 mr_free(tmp); 1258 1220 1259 tmp = call_program_and_get_last_line_of_output(command,TRUE); 1221 1260 mr_free(command); 1222 1261 1223 1262 if (!strcmp(tmp,"")) { 1224 if ((strstr(tmp, "LABEL=") != NULL) || (strstr(tmp,"UUID=") != NULL)) {1263 if ((strstr(tmp, "LABEL=") != NULL) || (strstr(tmp,"UUID=") != NULL)) { 1225 1264 if (!run_program_and_log_output("mount /boot", 5)) { 1226 1265 strcpy(g_boot_mountpt, "/boot"); -
branches/3.1/mondo/src/common/libmondo-tools.h
r2508 r3190 6 6 7 7 long get_time(); 8 extern void (*log_debug_msg) (int debug_level, const char *szFile, 8 char *mr_date(void); 9 extern void (*log_debsug_msg) (int debug_level, const char *szFile, 9 10 const char *szFunction, int nLine, 10 11 const char *fmt, ...); -
branches/3.1/mondo/src/common/libmondo-verify.c
r3161 r3190 161 161 if (g_last_afioball_number != set_number - 1) { 162 162 if (set_number == 0) { 163 log_msg(1, 164 "Weird error in verify_afioballs_on_CD() but it's really a cosmetic error, nothing more"); 163 log_msg(1, "Weird error in verify_afioballs_on_CD() but it's really a cosmetic error, nothing more"); 165 164 } else { 166 165 retval++; … … 305 304 log_to_screen("%s/%s not found on live filesystem", bkpinfo->restore_path, biggiestruct.filename); 306 305 mr_asprintf(tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", bkpinfo->restore_path, biggiestruct.filename, bkpinfo->tmpdir); 307 if (system(tmp)) { 308 //FIXME 309 } 306 paranoid_system(tmp); 310 307 mr_free(tmp); 311 308 … … 637 634 char *orig_cksum = NULL; 638 635 char *tmp = NULL; 639 char *slice_fnam ;636 char *slice_fnam = NULL; 640 637 641 638 /*@ pointers ******************************************************** */ -
branches/3.1/mondo/src/common/mondostructures.h
r3147 r3190 23 23 */ 24 24 25 26 /** @def MAX_NOOF_MEDIA The maximum number of media that can be used in any one backup. */27 ///* So we can override it in config.h: */28 //#ifndef MAX_NOOF_MEDIA29 #define MAX_NOOF_MEDIA 5030 //#endif31 25 32 26 /** … … 343 337 344 338 /** 345 * An array containing the sizes of each media in our backup set, in MB. 346 * For example, media 1's size would be stored in media_size[1]. 347 * Element 0 is unused. 339 * A field containing the sizes of the media in our backup set, in MB. 348 340 * If the size should be autodetected, make it -1 (preferable) or 0. 349 * @bug This should probably be only one variable, not an array. 350 */ 351 long media_size[MAX_NOOF_MEDIA + 1]; 341 */ 342 long media_size; 352 343 353 344 /** -
branches/3.1/mondo/src/common/newt-specific.c
r3161 r3190 122 122 123 123 /*@ buffers ********************************************************** */ 124 int i ;125 char *tmp ;124 int i = 0; 125 char *tmp = NULL; 126 126 127 127 assert_string_is_neither_NULL_nor_zerolength(prompt); … … 173 173 int i; 174 174 175 assert_string_is_neither_NULL_nor_zerolength(prompt); 175 176 if (g_fail_immediately) { 176 177 // We consider the user aborted by using the -F option … … 326 327 paranoid_system("killall mindi 2> /dev/null"); 327 328 kill_anything_like_this("/mondo/do-not"); 328 kill_anything_like_this(" tmp.mondo");329 kill_anything_like_this("mondo.tmp"); 329 330 kill_anything_like_this("ntfsclone"); 330 331 sync(); … … 420 421 free_newt_stuff(); 421 422 if (!g_text_mode) { 422 log_msg(1, "Calling newtFinished()"); 423 newtFinished(); 423 if (does_file_exist("/THIS-IS-A-RAMDISK")) { 424 log_msg(1, "Calling newtFinished()"); 425 newtFinished(); 426 } else { 427 log_msg(1, "Calling newtSuspend()"); 428 newtSuspend(); 429 } 424 430 } 425 431 printf("Execution run ended; result=%d\n", signal); … … 440 446 char *command = NULL; 441 447 char *tmp = NULL; 448 char *p = NULL; 442 449 443 450 /*@ pointers ********************************************************* */ … … 465 472 for (err_log_lines[i][0] = '\0'; 466 473 strlen(err_log_lines[i]) < 2 && !feof(fin);) { 467 if (fgets(err_log_lines[i], MAX_NEWT_COMMENT_LEN, fin)) { 468 //FIXME 474 p = fgets(err_log_lines[i], MAX_NEWT_COMMENT_LEN, fin); 475 if (!p) { 476 // FIXME 469 477 } 470 478 /* Commented to make valgrind happy and avoid crash … … 571 579 572 580 /*@ buffers ********************************************************* */ 573 char *title = NULL;574 581 char *tmp = NULL; 575 582 … … 580 587 assert(ttl != NULL); 581 588 malloc_string(tmp); 582 mr_asprintf(title, "%s", ttl); 583 strcpy(g_isoform_header_str, title); 584 if (g_text_mode) { 585 log_msg(0, title); 586 } else { 587 strcpy(tmp, title); 589 strcpy(g_isoform_header_str, ttl); 590 if (g_text_mode) { 591 log_msg(0, ttl); 592 } else { 593 strcpy(tmp, ttl); 588 594 center_string(tmp, 80); 589 595 newtPushHelpLine(tmp); … … 596 602 g_isoform_header = newtLabel(1, 1, g_isoform_header_str); 597 603 g_isoform_scale = newtScale(3, 3, 34, 100); 598 newtCenteredWindow(40, 7, t itle);604 newtCenteredWindow(40, 7, ttl); 599 605 g_isoform_main = newtForm(NULL, NULL, 0); 600 606 g_isoform_timeline = newtLabel(1, 5, " "); … … 607 613 } 608 614 update_evalcall_form(0); 609 mr_free(title);610 615 paranoid_free(tmp); 611 616 } … … 971 976 } 972 977 if (percentage >= 3) { 973 mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, time_remaining / 60,time_remaining % 60);978 mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, (long) time_remaining / 60, (long) time_remaining % 60); 974 979 printf("---evalcall---1--- %s\n", g_isoform_header_str); 975 980 printf("---evalcall---2--- %s\n", taskprogress); … … 1225 1230 mr_free(title_sz); 1226 1231 mr_free(minimsg_sz); 1227 paranoid_free(outstr);1228 1232 return (output); 1229 1233 } … … 1369 1373 log_msg(2, "Loading %s", source_file); 1370 1374 for (filelist->entries = 0; filelist->entries <= ARBITRARY_MAXIMUM; ) { 1371 if (tmp != NULL) { 1372 mr_free(tmp); 1373 } 1375 mr_free(tmp); 1374 1376 if (feof(fin)) { 1375 1377 break; … … 1568 1570 } 1569 1571 } 1570 1571 1572 newtFormDestroy(myForm); 1572 1573 newtPopWindow();
Note:
See TracChangeset
for help on using the changeset viewer.