Changeset 3193 in MondoRescue for branches/3.2/mondo/src/mondorestore/mondorestore.c
- Timestamp:
- Sep 29, 2013, 9:31:34 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/mondorestore/mondorestore.c
r3185 r3193 253 253 struct raidlist_itself *raidlist) 254 254 { 255 char c, *tmp; 255 char c; 256 char *tmp = NULL; 256 257 int retval = 0; 257 258 … … 260 261 assert(mountlist != NULL); 261 262 assert(raidlist != NULL); 262 malloc_string(tmp);263 263 log_it("pre wrm"); 264 264 c = which_restore_mode(); … … 274 274 } 275 275 if (g_ISO_restore_mode) { 276 sprintf(tmp, "umount -d %s", bkpinfo->isodir);276 mr_asprintf(tmp, "umount -d %s", bkpinfo->isodir); 277 277 run_program_and_log_output(tmp, FALSE); 278 mr_free(tmp); 278 279 } 279 280 paranoid_MR_finish(0); … … 284 285 if (bkpinfo->backup_media_type == iso) { 285 286 if (iso_fiddly_bits((c == 'N') ? TRUE : FALSE)) { 286 log_msg(2, "catchall_mode --- iso_fiddly_bits returned w/ error"); 287 log_msg(2, 288 "catchall_mode --- iso_fiddly_bits returned w/ error"); 287 289 return (1); 288 290 } else { … … 301 303 retval += compare_mode(mountlist, raidlist); 302 304 } 303 paranoid_free(tmp);304 305 return (retval); 305 306 } … … 418 419 * @return 0 for success, or the number of errors encountered. 419 420 */ 420 int 421 interactive_mode(struct mountlist_itself *mountlist, 422 struct raidlist_itself *raidlist) 421 int interactive_mode(struct mountlist_itself *mountlist, struct raidlist_itself *raidlist) 423 422 { 424 423 int retval = 0; … … 432 431 /** needs malloc **********/ 433 432 char *tmp; 434 char *fstab_fname; 435 char *old_restpath; 433 char *p = NULL; 434 char *tmp1 = NULL; 435 char *fstab_fname = NULL; 436 char *old_restpath = NULL; 436 437 437 438 struct s_node *filelist; … … 442 443 443 444 malloc_string(tmp); 444 malloc_string(fstab_fname);445 malloc_string(old_restpath);446 445 assert(bkpinfo != NULL); 447 446 assert(mountlist != NULL); … … 451 450 452 451 if (g_text_mode) { 453 if (!ask_me_yes_or_no 454 ("Interactive Mode + textonly = experimental! Proceed anyway?")) 455 { 452 if (!ask_me_yes_or_no("Interactive Mode + textonly = experimental! Proceed anyway?")) { 456 453 fatal_error("Wise move."); 457 454 } … … 463 460 log_it("Done loading config file; resizing ML"); 464 461 465 #ifdef __FreeBSD__ 466 if (strstr 467 (call_program_and_get_last_line_of_output("cat /tmp/cmdline"), 468 "noresize")) 469 #else 470 if (strstr 471 (call_program_and_get_last_line_of_output("cat /proc/cmdline"), 472 "noresize")) 473 #endif 474 { 462 mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output("cat " CMDLINE); 463 if (strstr(tmp1, "noresize")) { 475 464 log_msg(1, "Not resizing mountlist."); 476 465 } else { 477 466 resize_mountlist_proportionately_to_suit_new_drives(mountlist); 478 467 } 468 mr_free(tmp1); 469 479 470 for (done = FALSE; !done;) { 480 471 log_it("About to edit mountlist"); 481 472 if (g_text_mode) { 482 473 save_mountlist_to_disk(mountlist, g_mountlist_fname); 483 sprintf(tmp, "%s %s", find_my_editor(), g_mountlist_fname); 484 res = system(tmp); 474 mr_asprintf(tmp1, "%s %s", find_my_editor(), g_mountlist_fname); 475 res = system(tmp1); 476 mr_free(tmp1); 485 477 load_mountlist(mountlist, g_mountlist_fname); 486 478 } else { … … 571 563 } 572 564 /* restore */ 573 if ((restore_all = 574 ask_me_yes_or_no("Do you want me to restore all of your data?"))) 575 { 565 if ((restore_all = ask_me_yes_or_no("Do you want me to restore all of your data?"))) { 576 566 log_msg(1, "Restoring all data"); 577 567 retval += restore_everything(NULL); 578 } else 579 if ((restore_all = 580 ask_me_yes_or_no 581 ("Do you want me to restore _some_ of your data?"))) { 582 strcpy(old_restpath, bkpinfo->restore_path); 568 } else if ((restore_all = ask_me_yes_or_no("Do you want me to restore _some_ of your data?"))) { 569 mr_asprintf(old_restpath, "%s", bkpinfo->restore_path); 583 570 for (done = FALSE; !done;) { 584 571 unlink("/tmp/filelist.full"); … … 590 577 gotos_suck: 591 578 strcpy(tmp, old_restpath); 592 // (NB: %s is where your filesystem is mounted now, by default)", MNT_RESTORING);579 // (NB: %s is where your filesystem is mounted now, by default)", MNT_RESTORING); 593 580 if (popup_and_get_string 594 581 ("Restore path", "Restore files to where?", tmp, … … 608 595 free_filelist(filelist); 609 596 } 610 if (!ask_me_yes_or_no 611 ("Restore another subset of your backup?")) { 597 if (!ask_me_yes_or_no("Restore another subset of your backup?")) { 612 598 done = TRUE; 613 599 } … … 616 602 } 617 603 } 618 strcpy(old_restpath, bkpinfo->restore_path); 619 } else { 620 mvaddstr_and_log_it(g_currentY++, 621 0, 622 "User opted not to restore any data. "); 604 mr_free(old_restpath); 605 } else { 606 mvaddstr_and_log_it(g_currentY++, 0, "User opted not to restore any data. "); 623 607 } 624 608 if (retval) { 625 mvaddstr_and_log_it(g_currentY++, 626 0, 627 "Errors occurred during the restore phase. "); 609 mvaddstr_and_log_it(g_currentY++, 0, "Errors occurred during the restore phase. "); 628 610 } 629 611 … … 647 629 "Using tune2fs/tune4fs to identify your ext2,3,4 partitions"); 648 630 if (does_file_exist("/tmp/fstab.new")) { 649 strcpy(fstab_fname, "/tmp/fstab.new");631 mr_asprintf(fstab_fname, "/tmp/fstab.new"); 650 632 } else { 651 strcpy(fstab_fname, "/tmp/fstab");652 } 653 sprintf(tmp,654 "label-partitions-as-necessary %s < %s >> %s 2>> %s",655 g_mountlist_fname, fstab_fname, MONDO_LOGFILE, 656 MONDO_LOGFILE);657 res = system(tmp);633 mr_asprintf(fstab_fname, "/tmp/fstab"); 634 } 635 mr_asprintf(tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE); 636 mr_free(fstab_fname); 637 638 res = system(tmp1); 639 mr_free(tmp1); 658 640 if (res) { 659 641 log_to_screen … … 674 656 end_of_func: 675 657 paranoid_free(tmp); 676 paranoid_free(fstab_fname);677 paranoid_free(old_restpath);678 658 log_it("Leaving interactive_mode()"); 679 659 return (retval); … … 759 739 int retval = 0; 760 740 int res = 0; 761 /** malloc **/ 762 char tmp[MAX_STR_LEN];741 char *tmp = NULL; 742 char *tmp1 = NULL; 763 743 char *flaws_str = NULL; 764 744 … … 772 752 load_mountlist(mountlist, g_mountlist_fname); // in case read_cfg_file_into_bkpinfo updated the mountlist 773 753 #ifdef __FreeBSD__ 774 if (strstr 775 (call_program_and_get_last_line_of_output("cat /tmp/cmdline"), 776 "noresize")) 754 if (strstr(call_program_and_get_last_line_of_output("cat /tmp/cmdline"), "noresize")) 777 755 #else 778 if (strstr 779 (call_program_and_get_last_line_of_output("cat /proc/cmdline"), 780 "noresize")) 756 if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "noresize")) 781 757 #endif 782 758 { … … 812 788 twenty_seconds_til_yikes(); 813 789 g_fprep = fopen("/tmp/prep.sh", "w"); 814 #ifdef __FreeBSD__ 815 if (strstr 816 (call_program_and_get_last_line_of_output 817 ("cat /tmp/cmdline"), "nopart")) 818 #else 819 if (strstr 820 (call_program_and_get_last_line_of_output 821 ("cat /proc/cmdline"), "nopart")) 822 #endif 823 { 824 log_msg(2, 825 "Not partitioning drives due to 'nopart' option."); 790 mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output("cat " CMDLINE,TRUE)); 791 if (strstr(tmp1, "nopart")) { 792 log_msg(2, "Not partitioning drives due to 'nopart' option."); 826 793 res = 0; 827 794 } else { 828 795 res = partition_everything(mountlist); 829 796 if (res) { 830 log_to_screen 831 ("Warning. Errors occurred during partitioning."); 797 log_to_screen("Warning. Errors occurred during partitioning."); 832 798 res = 0; 833 799 } 834 800 } 801 mr_free(tmp1); 802 835 803 retval += res; 836 804 if (!res) { 837 805 log_to_screen("Preparing to format your disk(s)"); 838 806 sleep(1); 839 paranoid_system("sync");807 sync(); 840 808 log_to_screen("Please wait. This may take a few minutes."); 841 809 res += format_everything(mountlist, FALSE, raidlist); … … 880 848 "Using tune2fs/tune4fs to identify your ext2,3,4 partitions"); 881 849 882 sprintf(tmp, "label-partitions-as-necessary %s < /tmp/fstab >> %s 2>> %s", g_mountlist_fname, MONDO_LOGFILE, MONDO_LOGFILE);850 mr_asprintf(tmp1, "label-partitions-as-necessary %s < /tmp/fstab >> %s 2>> %s", MINDI_CACHE"/mountlist.txt", MONDO_LOGFILE, MONDO_LOGFILE); 883 851 res = run_program_and_log_output(tmp, TRUE); 852 mr_free(tmp1); 884 853 if (res) { 885 854 log_to_screen("label-partitions-as-necessary returned an error"); … … 891 860 892 861 after_the_nuke: 862 mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output("cat " CMDLINE,TRUE)); 893 863 if (retval) { 894 864 log_to_screen("Errors occurred during the nuke phase."); 895 } else if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "RESTORE")) { 896 log_to_screen 897 ("PC was restored successfully. Thank you for using Mondo Rescue."); 898 log_to_screen 899 ("Please visit our website at http://www.mondorescue.org for more information."); 900 } else { 901 strcpy(tmp,"Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information."); 902 popup_and_OK(tmp); 903 log_to_screen 904 ("Mondo has restored your system. Please wait for the command prompt."); 905 log_to_screen 906 ("Then remove the backup media and reboot."); 907 log_to_screen 908 ("Please visit our website at http://www.mondorescue.org for more information."); 909 } 865 } else if (strstr(tmp1, "RESTORE")) { 866 log_to_screen("PC was restored successfully. Thank you for using Mondo Rescue."); 867 log_to_screen("Please visit our website at http://www.mondorescue.org for more information."); 868 } else { 869 mr_asprintf(tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information."); 870 popup_and_OK(tmp); 871 mr_free(tmp); 872 log_to_screen("Mondo has restored your system. Please wait for the command prompt."); 873 log_to_screen("Then remove the backup media and reboot."); 874 log_to_screen("Please visit our website at http://www.mondorescue.org for more information."); 875 } 876 mr_free(tmp1); 877 910 878 g_I_have_just_nuked = TRUE; 911 879 return (retval); … … 928 896 int retval = 0; 929 897 930 /** malloc **/ 931 char *old_restpath; 898 char *old_restpath = NULL; 932 899 933 900 struct mountlist_itself *mountlist = NULL; 934 // static935 901 struct raidlist_itself *raidlist = NULL; 936 902 struct s_node *filelist = NULL; … … 938 904 log_msg(1, "restore_to_live_filesystem() - starting"); 939 905 assert(bkpinfo != NULL); 940 malloc_string(old_restpath);941 906 mountlist = malloc(sizeof(struct mountlist_itself)); 942 907 raidlist = malloc(sizeof(struct raidlist_itself)); … … 974 939 if (!g_restoring_live_from_netfs && (filelist = process_filelist_and_biggielist())) { 975 940 save_filelist(filelist, "/tmp/selected-files.txt"); 976 strcpy(old_restpath, bkpinfo->restore_path);941 mr_asprintf(old_restpath, "%s", bkpinfo->restore_path); 977 942 if (popup_and_get_string("Restore path", 978 943 "Restore files to where? )", … … 986 951 } 987 952 strcpy(bkpinfo->restore_path, old_restpath); 953 mr_free(old_restpath); 988 954 } else { 989 955 if (filelist != NULL) { … … 1004 970 eject_device(bkpinfo->media_device); 1005 971 } 1006 paranoid_free(old_restpath);1007 972 free(mountlist); 1008 973 free(raidlist); … … 1043 1008 1044 1009 /** malloc ***/ 1045 char *checksum, *outfile_fname, *tmp, *bzip2_command, 1046 *ntfsprog_command, *suffix, *sz_devfile; 1010 char *checksum = NULL; 1011 char *outfile_fname = NULL; 1012 char *tmp = NULL; 1013 char *bzip2_command = NULL; 1014 char *suffix = NULL; 1015 char *sz_devfile = NULL; 1047 1016 char *bigblk; 1048 1017 char *mds = NULL; … … 1051 1020 long sliceno; 1052 1021 long siz; 1053 char ntfsprog_fifo[MAX_STR_LEN];1022 char *ntfsprog_fifo = NULL; 1054 1023 char *file_to_openout = NULL; 1055 1024 struct s_filename_and_lstat_info biggiestruct; … … 1059 1028 int res = 0; 1060 1029 int old_loglevel; 1061 char sz_msg[MAX_STR_LEN];1062 1030 struct s_node *node; 1063 1031 … … 1065 1033 ubuf = &the_utime_buf; 1066 1034 assert(bkpinfo != NULL); 1067 1068 malloc_string(checksum);1069 malloc_string(outfile_fname);1070 malloc_string(tmp);1071 malloc_string(bzip2_command);1072 malloc_string(ntfsprog_command);1073 malloc_string(suffix);1074 malloc_string(sz_devfile);1075 1035 1076 1036 pathname_of_last_file_restored[0] = '\0'; … … 1092 1052 paranoid_fclose(fin); 1093 1053 1094 strcpy(checksum, biggiestruct.checksum); 1095 1054 mr_asprintf(checksum, "%s", biggiestruct.checksum); 1096 1055 if (!checksum[0]) { 1097 sprintf(tmp, "Warning - bigfile %ld does not have a checksum", 1098 bigfileno + 1); 1099 log_msg(3, tmp); 1100 } 1056 log_msg(3, "Warning - bigfile %ld does not have a checksum", bigfileno + 1); 1057 } 1058 mr_free(checksum); 1101 1059 1102 1060 if (!strncmp(biggiestruct.filename, "/dev/", 5)) // Whether NTFS or not :) 1103 1061 { 1104 strcpy(outfile_fname, biggiestruct.filename); 1105 } else { 1106 sprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, 1107 biggiestruct.filename); 1062 mr_asprintf(outfile_fname, "%s", biggiestruct.filename); 1063 } else { 1064 mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename); 1108 1065 } 1109 1066 … … 1112 1069 node = find_string_at_node(filelist, biggiestruct.filename); 1113 1070 if (!node) { 1114 log_msg(0, "Skipping %s (name isn't in filelist)", 1115 biggiestruct.filename); 1071 log_msg(0, "Skipping %s (name isn't in filelist)", biggiestruct.filename); 1116 1072 pathname_of_last_file_restored[0] = '\0'; 1117 1073 return (0); 1118 1074 } else if (!(node->selected)) { 1119 log_msg(1, "Skipping %s (name isn't in biggielist subset)", 1120 biggiestruct.filename); 1075 log_msg(1, "Skipping %s (name isn't in biggielist subset)", biggiestruct.filename); 1121 1076 pathname_of_last_file_restored[0] = '\0'; 1122 1077 return (0); 1123 1078 } 1124 1079 } 1080 1125 1081 /* otherwise, continue */ 1126 1127 1082 log_msg(1, "DEFINITELY restoring %s", biggiestruct.filename); 1128 1083 if (biggiestruct.use_ntfsprog) { 1129 1084 if (strncmp(biggiestruct.filename, "/dev/", 5)) { 1130 log_msg(1, 1131 "I was in error when I set biggiestruct.use_ntfsprog to TRUE."); 1085 log_msg(1, "I was in error when I set biggiestruct.use_ntfsprog to TRUE."); 1132 1086 log_msg(1, "%s isn't even in /dev", biggiestruct.filename); 1133 1087 biggiestruct.use_ntfsprog = FALSE; … … 1136 1090 1137 1091 if (biggiestruct.use_ntfsprog) // if it's an NTFS device 1138 // if (!strncmp ( biggiestruct.filename, "/dev/", 5))1139 1092 { 1140 1093 g_loglevel = 4; 1141 1094 use_ntfsprog_hack = TRUE; 1142 log_msg(2, 1143 "Calling ntfsclone in background because %s is an NTFS /dev entry", 1144 outfile_fname); 1145 sprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768), 1146 (int) (random() % 32768)); 1095 log_msg(2, "Calling ntfsclone in background because %s is an NTFS /dev entry", outfile_fname); 1096 mr_asprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768), (int) (random() % 32768)); 1147 1097 mkfifo(sz_devfile, 0x770); 1148 strcpy(ntfsprog_fifo, sz_devfile); 1098 mr_asprintf(ntfsprog_fifo, "%s", sz_devfile); 1099 mr_free(sz_devfile); 1149 1100 file_to_openout = ntfsprog_fifo; 1150 1101 switch (pid = fork()) { … … 1152 1103 fatal_error("Fork failure"); 1153 1104 case 0: 1154 log_msg(3, 1155 "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)", 1156 biggiestruct.filename, ntfsprog_fifo); 1157 res = 1158 feed_outfrom_ntfsprog(biggiestruct.filename, 1159 ntfsprog_fifo); 1160 // log_msg(3, "CHILD - fip - exiting"); 1105 log_msg(3, "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)", biggiestruct.filename, ntfsprog_fifo); 1106 res = feed_outfrom_ntfsprog(biggiestruct.filename, ntfsprog_fifo); 1107 mr_free(ntfsprog_fifo); 1161 1108 exit(res); 1162 1109 break; 1163 1110 default: 1164 log_msg(3, 1165 "feed_into_ntfsprog() called in background --- pid=%ld", 1166 (long int) (pid)); 1167 } 1111 log_msg(3, "feed_into_ntfsprog() called in background --- pid=%ld", (long int) (pid)); 1112 } 1113 mr_free(ntfsprog_fifo); 1168 1114 } else { 1169 1115 use_ntfsprog_hack = FALSE; 1170 ntfsprog_fifo[0] = '\0';1171 1116 file_to_openout = outfile_fname; 1172 1117 if (!does_file_exist(outfile_fname)) // yes, it looks weird with the '!' but it's correct that way … … 1176 1121 } 1177 1122 1178 sprintf(tmp, "Reassembling big file %ld (%s)", bigfileno + 1, 1179 outfile_fname); 1180 log_msg(2, tmp); 1123 log_msg(2, "Reassembling big file %ld (%s)", bigfileno + 1, outfile_fname); 1181 1124 1182 1125 /* … … 1186 1129 */ 1187 1130 1188 strncpy(pathname_of_last_file_restored, biggiestruct.filename, 1189 MAX_STR_LEN - 1); 1131 strncpy(pathname_of_last_file_restored, biggiestruct.filename, MAX_STR_LEN - 1); 1190 1132 pathname_of_last_file_restored[MAX_STR_LEN - 1] = '\0'; 1191 1133 … … 1198 1140 1199 1141 for (sliceno = 1, finished = FALSE; !finished;) { 1200 if (!does_file_exist 1201 (slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "")) 1202 && 1203 !does_file_exist(slice_fname 1204 (bigfileno, sliceno, ARCHIVES_PATH, "lzo")) 1205 && 1206 !does_file_exist(slice_fname 1207 (bigfileno, sliceno, ARCHIVES_PATH, "gz")) 1208 && 1209 !does_file_exist(slice_fname 1210 (bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) { 1211 log_msg(3, 1212 "Cannot find a data slice or terminator slice on CD %d", 1213 g_current_media_number); 1142 if (!does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "")) && 1143 !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "lzo")) && 1144 !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "gz")) && 1145 !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "lzma")) && 1146 !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) { 1147 log_msg(3, "Cannot find a data slice or terminator slice on CD %d", g_current_media_number); 1214 1148 g_current_media_number++; 1215 1149 mds = media_descriptor_string(bkpinfo->backup_media_type); 1216 sprintf(tmp, 1217 "Asking for %s #%d so that I may read slice #%ld\n", mds, 1218 g_current_media_number, sliceno); 1219 log_msg(2, tmp); 1220 sprintf(tmp, "Restoring from %s #%d", mds, g_current_media_number); 1150 log_msg(2, "Asking for %s #%d so that I may read slice #%ld\n", mds, g_current_media_number, sliceno); 1221 1151 mr_free(mds); 1222 1152 1223 log_to_screen(tmp); 1153 log_to_screen("Restoring from %s #%d", mds, g_current_media_number); 1154 1224 1155 insist_on_this_cd_number(g_current_media_number); 1225 1156 log_to_screen("Continuing to restore."); 1226 1157 } else { 1227 strcpy(tmp, 1228 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "")); 1158 mr_asprintf(tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "")); 1229 1159 if (does_file_exist(tmp) && length_of_file(tmp) == 0) { 1230 log_msg(2, 1231 "End of bigfile # %ld (slice %ld is the terminator)", 1232 bigfileno + 1, sliceno); 1160 log_msg(2, "End of bigfile # %ld (slice %ld is the terminator)", bigfileno + 1, sliceno); 1233 1161 finished = TRUE; 1162 mr_free(tmp); 1234 1163 continue; 1235 1164 } else { 1236 if (does_file_exist 1237 (slice_fname 1238 (bigfileno, sliceno, ARCHIVES_PATH, "lzo"))) { 1239 strcpy(bzip2_command, "lzop"); 1240 strcpy(suffix, "lzo"); 1165 if (does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "lzo"))) { 1166 mr_asprintf(bzip2_command, "lzop"); 1167 mr_asprintf(suffix, "lzo"); 1241 1168 } else 1242 if (does_file_exist 1243 (slice_fname 1244 (bigfileno, sliceno, ARCHIVES_PATH, "gz"))) { 1245 strcpy(bzip2_command, "gzip"); 1246 strcpy(suffix, "gz"); 1169 if (does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "gz"))) { 1170 mr_asprintf(bzip2_command, "gzip"); 1171 mr_asprintf(suffix, "gz"); 1247 1172 } else 1248 if (does_file_exist 1249 (slice_fname 1250 (bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) { 1251 strcpy(bzip2_command, "bzip2"); 1252 strcpy(suffix, "bz2"); 1173 if (does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "lzma"))) { 1174 mr_asprintf(bzip2_command, "lzma"); 1175 mr_asprintf(suffix, "lzma"); 1253 1176 } else 1254 if (does_file_exist 1255 (slice_fname 1256 (bigfileno, sliceno, ARCHIVES_PATH, ""))) { 1257 strcpy(bzip2_command, ""); 1258 strcpy(suffix, ""); 1177 if (does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) { 1178 mr_asprintf(bzip2_command, "bzip2"); 1179 mr_asprintf(suffix, "bz2"); 1180 } else 1181 if (does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, ""))) { 1182 mr_asprintf(bzip2_command, ""); 1183 mr_asprintf(suffix, ""); 1259 1184 } else { 1260 1185 log_to_screen("OK, that's pretty fsck0red..."); 1186 mr_free(tmp); 1261 1187 return (1); 1262 1188 } 1263 1189 } 1264 if (bzip2_command[0] != '\0') { 1265 sprintf(bzip2_command + strlen(bzip2_command), 1266 " -dc %s 2>> %s", 1267 slice_fname(bigfileno, sliceno, ARCHIVES_PATH, 1268 suffix), MONDO_LOGFILE); 1190 mr_free(tmp); 1191 if (bzip2_command != NULL) { 1192 mr_strcat(bzip2_command, " -dc %s 2>> %s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1269 1193 } else { 1270 sprintf(bzip2_command, "cat %s 2>> %s",1271 slice_fname(bigfileno, sliceno, ARCHIVES_PATH,1272 suffix), MONDO_LOGFILE);1273 } 1194 mr_asprintf(bzip2_command, "cat %s 2>> %s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE); 1195 } 1196 mr_free(suffix); 1197 1274 1198 mds = media_descriptor_string(bkpinfo->backup_media_type); 1275 sprintf(tmp, "Working on %s #%d, file #%ld, slice #%ld ", mds, 1276 g_current_media_number, bigfileno + 1, sliceno); 1199 mr_asprintf(tmp, "Working on %s #%d, file #%ld, slice #%ld ", mds, g_current_media_number, bigfileno + 1, sliceno); 1277 1200 mr_free(mds); 1278 1201 log_msg(2, tmp); … … 1284 1207 update_progress_form(tmp); 1285 1208 } 1209 mr_free(tmp); 1210 1286 1211 if (!(fbzip2 = popen(bzip2_command, "r"))) { 1287 1212 fatal_error("Can't run popen command"); 1288 1213 } 1214 mr_free(bzip2_command); 1215 1289 1216 while (!feof(fbzip2)) { 1290 1217 siz = fread(bigblk, 1, TAPE_BLOCK_SIZE, fbzip2); 1291 1218 if (siz > 0) { 1292 sprintf(sz_msg, "Read %ld from fbzip2", siz);1293 1219 siz = fwrite(bigblk, 1, siz, fout); 1294 sprintf(sz_msg + strlen(sz_msg),1295 "; written %ld to fout", siz);1296 // log_msg(2. sz_msg);1297 1220 } 1298 1221 } … … 1304 1227 } 1305 1228 } 1306 /*1307 memset(bigblk, TAPE_BLOCK_SIZE, 1); // This all looks very fishy...1308 fwrite( bigblk, 1, TAPE_BLOCK_SIZE, fout);1309 fwrite( bigblk, 1, TAPE_BLOCK_SIZE, fout);1310 fwrite( bigblk, 1, TAPE_BLOCK_SIZE, fout);1311 fwrite( bigblk, 1, TAPE_BLOCK_SIZE, fout);1312 */1313 1229 paranoid_fclose(fout); 1314 1230 g_loglevel = old_loglevel; … … 1316 1232 if (use_ntfsprog_hack) { 1317 1233 log_msg(3, "Waiting for ntfsclone to finish"); 1318 sprintf(tmp, 1319 " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1234 mr_asprintf(tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1320 1235 while (system(tmp) == 0) { 1321 1236 sleep(1); 1322 1237 } 1238 mr_free(tmp); 1323 1239 log_it("OK, ntfsclone has really finished"); 1324 1240 } 1325 1241 1326 1242 if (strcmp(outfile_fname, "/dev/null")) { 1327 if (chown(outfile_fname, biggiestruct.properties.st_uid, 1328 biggiestruct.properties.st_gid)) { 1243 if (chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid)) { 1329 1244 // FIXME 1330 1245 } … … 1334 1249 utime(outfile_fname, ubuf); 1335 1250 } 1251 mr_free(outfile_fname); 1336 1252 paranoid_free(bigblk); 1337 paranoid_free(checksum);1338 paranoid_free(outfile_fname);1339 paranoid_free(tmp);1340 paranoid_free(bzip2_command);1341 paranoid_free(ntfsprog_command);1342 paranoid_free(suffix);1343 paranoid_free(sz_devfile);1344 1253 1345 1254 return (retval); … … 1376 1285 1377 1286 /** mallocs ********/ 1378 char *tmp ;1379 char * command;1380 char * outfile_fname;1381 char * ntfsprog_command;1382 char *sz_devfile ;1383 char *ntfsprog_fifo ;1287 char *tmp = NULL; 1288 char *tmp1 = NULL; 1289 char *command = NULL; 1290 char *outfile_fname = NULL; 1291 char *sz_devfile = NULL; 1292 char *ntfsprog_fifo = NULL; 1384 1293 char *file_to_openout = NULL; 1385 1294 … … 1400 1309 1401 1310 malloc_string(tmp); 1402 malloc_string(ntfsprog_fifo);1403 malloc_string(outfile_fname);1404 malloc_string(command);1405 malloc_string(sz_devfile);1406 malloc_string(ntfsprog_command);1407 1311 old_loglevel = g_loglevel; 1408 1312 assert(bkpinfo != NULL); … … 1455 1359 if (use_ntfsprog) { 1456 1360 g_loglevel = 4; 1457 strcpy(outfile_fname, orig_bf_fname);1361 mr_asprintf(outfile_fname, "%s", orig_bf_fname); 1458 1362 use_ntfsprog_hack = TRUE; 1459 log_msg(2, 1460 "Calling ntfsclone in background because %s is a /dev entry", 1461 outfile_fname); 1462 sprintf(sz_devfile, "%s/%d.%d.000", 1463 bkpinfo->tmpdir, 1464 (int) (random() % 32768), 1465 (int) (random() % 32768)); 1363 log_msg(2, "Calling ntfsclone in background because %s is a /dev entry", outfile_fname); 1364 mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768)); 1466 1365 mkfifo(sz_devfile, 0x770); 1467 strcpy(ntfsprog_fifo, sz_devfile); 1366 mr_asprintf(ntfsprog_fifo, "%s", sz_devfile); 1367 mr_free(sz_devfile); 1368 1468 1369 file_to_openout = ntfsprog_fifo; 1469 1370 switch (pid = fork()) { … … 1471 1372 fatal_error("Fork failure"); 1472 1373 case 0: 1473 log_msg(3, 1474 "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)", 1475 outfile_fname, ntfsprog_fifo); 1476 res = 1477 feed_outfrom_ntfsprog(outfile_fname, ntfsprog_fifo); 1478 // log_msg(3, "CHILD - fip - exiting"); 1374 log_msg(3, "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)", outfile_fname, ntfsprog_fifo); 1375 res = feed_outfrom_ntfsprog(outfile_fname, ntfsprog_fifo); 1376 mr_free(ntfsprog_fifo); 1479 1377 exit(res); 1480 1378 break; 1481 1379 default: 1482 log_msg(3, 1483 "feed_into_ntfsprog() called in background --- pid=%ld", 1484 (long int) (pid)); 1485 } 1486 } else { 1487 if (!strncmp(orig_bf_fname, "/dev/", 5)) // non-NTFS partition 1488 { 1489 strcpy(outfile_fname, orig_bf_fname); 1490 } else // biggiefile 1491 { 1492 sprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, 1493 orig_bf_fname); 1380 log_msg(3, "feed_into_ntfsprog() called in background --- pid=%ld", (long int) (pid)); 1381 } 1382 mr_free(ntfsprog_fifo); 1383 } else { 1384 if (!strncmp(orig_bf_fname, "/dev/", 5)) { 1385 // non-NTFS partition 1386 mr_asprintf(outfile_fname, "%s", orig_bf_fname); 1387 } else { 1388 // biggiefile 1389 mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname); 1494 1390 } 1495 1391 use_ntfsprog_hack = FALSE; 1496 ntfsprog_fifo[0] = '\0';1497 1392 file_to_openout = outfile_fname; 1498 1393 if (!does_file_exist(outfile_fname)) // yes, it looks weird with the '!' but it's correct that way … … 1500 1395 make_hole_for_file(outfile_fname); 1501 1396 } 1502 sprintf(tmp, "Reassembling big file %ld (%s)", 1503 biggiefile_number + 1, orig_bf_fname); 1504 log_msg(2, tmp); 1397 log_msg(2, "Reassembling big file %ld (%s)", biggiefile_number + 1, orig_bf_fname); 1505 1398 } 1506 1399 1507 1400 if (dummy_restore) { 1508 sprintf(outfile_fname, "/dev/null"); 1401 mr_free(outfile_fname); 1402 mr_asprintf(outfile_fname, "/dev/null"); 1509 1403 } 1510 1404 1511 1405 if (!bkpinfo->zip_exe[0]) { 1512 sprintf(command, "cat > \"%s\"", file_to_openout); 1513 } else { 1514 sprintf(command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, 1515 file_to_openout, MONDO_LOGFILE); 1406 mr_asprintf(command, "cat > \"%s\"", file_to_openout); 1407 } else { 1408 mr_asprintf(command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE); 1516 1409 if (strcmp(bkpinfo->zip_exe, "gzip") == 0) { 1517 1410 /* Ignore SIGPIPE for gzip as it causes errors on big files 1518 * Cf: http://trac.mondorescue.org/ticket/244 1519 */ 1411 * Cf: http://trac.mondorescue.org/ticket/244 */ 1520 1412 signal(SIGPIPE,SIG_IGN); 1521 1413 } 1522 1414 } 1523 sprintf(tmp, "Pipe command = '%s'", command); 1524 log_msg(3, tmp); 1415 log_msg(3, "Pipe command = '%s'", command); 1525 1416 1526 1417 /* restore biggiefile, one slice at a time */ … … 1528 1419 fatal_error("Cannot pipe out"); 1529 1420 } 1421 mr_free(command); 1422 1530 1423 for (res = read_header_block_from_stream(&slice_siz, tmp, &ctrl_chr); 1531 1424 ctrl_chr != BLK_STOP_A_BIGGIE; … … 1534 1427 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 1535 1428 } 1536 sprintf(tmp, "Working on file #%ld, slice #%ld ", 1537 biggiefile_number + 1, current_slice_number); 1538 log_msg(2, tmp); 1429 log_msg(2, "Working on file #%ld, slice #%ld ", biggiefile_number + 1, current_slice_number); 1539 1430 if (!g_text_mode) { 1540 1431 newtDrawRootText(0, g_noof_rows - 2, tmp); … … 1575 1466 if (bkpinfo->zip_exe[0]) { 1576 1467 if (strcmp(bkpinfo->zip_exe, "gzip") == 0) { 1577 /* Re-enable SIGPIPE for gzip 1578 */ 1468 /* Re-enable SIGPIPE for gzip */ 1579 1469 signal(SIGPIPE, terminate_daemon); 1580 1470 } … … 1586 1476 if (use_ntfsprog_hack) { 1587 1477 log_msg(3, "Waiting for ntfsclone to finish"); 1588 sprintf(tmp, 1589 " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1590 while (system(tmp) == 0) { 1478 mr_asprintf(tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null"); 1479 while (system(tmp1) == 0) { 1591 1480 sleep(1); 1592 1481 } 1482 mr_free(tmp1); 1593 1483 log_msg(3, "OK, ntfsclone has really finished"); 1594 1484 } … … 1598 1488 if (strcmp(outfile_fname, "/dev/null")) { 1599 1489 chmod(outfile_fname, biggiestruct.properties.st_mode); 1600 if (chown(outfile_fname, biggiestruct.properties.st_uid, 1601 biggiestruct.properties.st_gid)) { 1490 if (chown(outfile_fname, biggiestruct.properties.st_uid, biggiestruct.properties.st_gid)) { 1602 1491 // FIXME 1603 1492 } … … 1606 1495 utime(outfile_fname, ubuf); 1607 1496 } 1497 mr_free(outfile_fname); 1608 1498 1609 1499 paranoid_free(tmp); 1610 paranoid_free(outfile_fname);1611 paranoid_free(command);1612 paranoid_free(ntfsprog_command);1613 paranoid_free(sz_devfile);1614 paranoid_free(ntfsprog_fifo);1615 1500 g_loglevel = old_loglevel; 1616 1501 return (retval); … … 1645 1530 /** malloc **/ 1646 1531 char *command = NULL; 1647 char *tmp; 1648 char *filelist_name; 1649 char *filelist_subset_fname; 1650 char *executable; 1651 char *temp_log; 1652 char screen_message[100]; 1532 char *tmp = NULL; 1533 char *filelist_name = NULL; 1534 char *filelist_subset_fname = NULL; 1535 char *executable = NULL; 1536 char *temp_log = NULL; 1653 1537 long matches = 0; 1654 1538 bool use_star; 1655 char *xattr_fname; 1656 char *acl_fname; 1657 // char files_to_restore_this_time_fname[MAX_STR_LEN]; 1539 char *xattr_fname = NULL; 1540 char *acl_fname = NULL; 1658 1541 1659 1542 assert_string_is_neither_NULL_nor_zerolength(tarball_fname); 1660 malloc_string(tmp);1661 malloc_string(filelist_name);1662 malloc_string(filelist_subset_fname);1663 malloc_string(executable);1664 malloc_string(temp_log);1665 malloc_string(xattr_fname);1666 malloc_string(acl_fname);1667 1543 1668 1544 log_msg(5, "Entering"); 1669 filelist_subset_fname[0] = '\0';1670 1545 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 1671 // sprintf(files_to_restore_this_time_fname, "/tmp/ftrttf.%d.%d", (int)getpid(), (int)random());1672 1546 mr_asprintf(command, "mkdir -p %s/tmp", MNT_RESTORING); 1673 1547 run_program_and_log_output(command, 9); 1674 1548 paranoid_free(command); 1675 1549 1676 sprintf(temp_log, "/tmp/%d.%d", (int) (random() % 32768), 1677 (int) (random() % 32768)); 1678 1679 sprintf(filelist_name, MNT_CDROM "/archives/filelist.%ld", 1680 current_tarball_number); 1550 mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number); 1681 1551 if (length_of_file(filelist_name) <= 2) { 1682 log_msg(2, "There are _zero_ files in filelist '%s'", 1683 filelist_name); 1684 log_msg(2, 1685 "This is a bit silly (ask dev-team to fix mondo_makefilelist, please)"); 1686 log_msg(2, 1687 "but it's non-critical. It's cosmetic. Don't worry about it."); 1552 log_msg(2, "There are _zero_ files in filelist '%s'", filelist_name); 1553 log_msg(2, "This is a bit silly (ask dev-team to fix mondo_makefilelist, please)"); 1554 log_msg(2, "but it's non-critical. It's cosmetic. Don't worry about it."); 1688 1555 retval = 0; 1689 goto leave_sub; 1690 } 1691 if (count_lines_in_file(filelist_name) <= 0 1692 || length_of_file(tarball_fname) <= 0) { 1556 mr_free(filelist_name); 1557 log_msg(5, "Leaving"); 1558 return(0); 1559 } 1560 if (count_lines_in_file(filelist_name) <= 0 || length_of_file(tarball_fname) <= 0) { 1693 1561 log_msg(3, "length_of_file(%s) = %llu", tarball_fname, length_of_file(tarball_fname)); 1694 1562 log_msg(3, "count_lines_in_file(%s) = %llu", tarball_fname, count_lines_in_file(tarball_fname)); 1695 sprintf(tmp, "Unable to restore fileset #%ld (CD I/O error)", 1696 current_tarball_number); 1697 log_to_screen(tmp); 1698 retval = 1; 1699 goto leave_sub; 1563 log_to_screen("Unable to restore fileset #%ld (CD I/O error)", current_tarball_number); 1564 mr_free(filelist_name); 1565 log_msg(5, "Leaving"); 1566 return(1); 1700 1567 } 1701 1568 1702 1569 if (filelist) { 1703 sprintf(filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", 1704 current_tarball_number); 1570 mr_asprintf(filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number); 1705 1571 if ((matches = 1706 1572 save_filelist_entries_in_common(filelist_name, filelist, 1707 1573 filelist_subset_fname, 1708 use_star)) 1709 <= 0) { 1710 sprintf(tmp, "Skipping fileset %ld", current_tarball_number); 1711 log_msg(1, tmp); 1574 use_star)) <= 0) { 1575 log_msg(1, "Skipping fileset %ld", current_tarball_number); 1712 1576 } else { 1713 log_msg(3, "Saved fileset %ld's subset to %s", 1714 current_tarball_number, filelist_subset_fname); 1715 } 1716 sprintf(screen_message, "Tarball #%ld --- %ld matches", 1717 current_tarball_number, matches); 1718 log_to_screen(screen_message); 1719 } else { 1720 filelist_subset_fname[0] = '\0'; 1721 } 1577 log_msg(3, "Saved fileset %ld's subset to %s", current_tarball_number, filelist_subset_fname); 1578 } 1579 log_to_screen("Tarball #%ld --- %ld matches", current_tarball_number, matches); 1580 } 1581 mr_free(filelist_name); 1722 1582 1723 1583 if (filelist == NULL || matches > 0) { 1724 1584 if (g_getfattr) { 1725 sprintf(xattr_fname, XATTR_LIST_FNAME_RAW_SZ, 1726 MNT_CDROM "/archives", current_tarball_number); 1585 mr_asprintf(xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number); 1727 1586 } 1728 1587 if (g_getfacl) { 1729 sprintf(acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", 1730 current_tarball_number); 1588 mr_asprintf(acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number); 1731 1589 } 1732 1590 if (strstr(tarball_fname, ".bz2")) { 1733 strcpy(executable, "bzip2"); 1591 mr_asprintf(executable, "bzip2"); 1592 } else if (strstr(tarball_fname, ".lzma")) { 1593 mr_asprintf(executable, "lzma"); 1734 1594 } else if (strstr(tarball_fname, ".gz")) { 1735 strcpy(executable, "gzip");1595 mr_asprintf(executable, "gzip"); 1736 1596 } else if (strstr(tarball_fname, ".lzo")) { 1737 strcpy(executable, "lzop");1738 } else {1739 executable[0] = '\0';1740 }1741 if (executable[0]) {1742 sprintf(tmp, "which %s > /dev/null 2> /dev/null", executable);1743 if (run_program_and_log_output(tmp, FALSE)) { 1744 log_to_screen1745 1597 mr_asprintf(executable, "lzop"); 1598 } 1599 if (executable) { 1600 mr_asprintf(tmp, "which %s > /dev/null 2> /dev/null", executable); 1601 res = run_program_and_log_output(tmp, FALSE); 1602 mr_free(tmp); 1603 1604 if (res) { 1605 log_to_screen("(compare_a_tarball) Compression program %s not found - oh no!", executable); 1746 1606 paranoid_MR_finish(1); 1747 1607 } 1748 strcpy(tmp, executable); 1749 sprintf(executable, "-P %s -Z", tmp); 1608 tmp = executable; 1609 mr_asprintf(executable, "-P %s -Z", tmp); 1610 mr_free(tmp); 1750 1611 } 1751 1612 #ifdef __FreeBSD__ … … 1755 1616 #endif 1756 1617 1757 // if (strstr(tarball_fname, ".star."))1758 1618 if (use_star) { 1759 1619 mr_asprintf(command, "star -x -force-remove -sparse -U " STAR_ACL_SZ " file=%s", tarball_fname); … … 1762 1622 } 1763 1623 } else { 1764 if ( filelist_subset_fname[0] != '\0') {1765 mr_asprintf(command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname);1624 if (! executable) { 1625 log_msg(2, "Mo executable, this shouldn't happen !"); 1766 1626 } else { 1767 mr_asprintf(command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname); 1768 } 1769 } 1627 if (filelist_subset_fname != NULL) { 1628 mr_asprintf(command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname); 1629 } else { 1630 mr_asprintf(command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname); 1631 } 1632 } 1633 } 1634 mr_free(executable); 1770 1635 1771 1636 #undef BUFSIZE 1637 mr_asprintf(temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768)); 1638 1772 1639 mr_strcat(command, " 2>> %s >> %s", temp_log, temp_log); 1773 1640 log_msg(1, "command = '%s'", command); … … 1828 1695 log_msg(2, "Fileset #%d processed OK", current_tarball_number); 1829 1696 } 1697 unlink(temp_log); 1698 mr_free(temp_log); 1830 1699 } 1831 1700 if (does_file_exist("/PAUSE")) { … … 1834 1703 } 1835 1704 unlink(filelist_subset_fname); 1836 unlink(xattr_fname); 1837 unlink(acl_fname); 1838 unlink(temp_log); 1839 1840 leave_sub: 1841 paranoid_free(tmp); 1842 paranoid_free(filelist_name); 1843 paranoid_free(filelist_subset_fname); 1844 paranoid_free(executable); 1845 paranoid_free(temp_log); 1846 paranoid_free(xattr_fname); 1847 paranoid_free(acl_fname); 1705 mr_free(filelist_subset_fname); 1706 if (g_getfattr) { 1707 unlink(xattr_fname); 1708 mr_free(xattr_fname); 1709 } 1710 if (g_getfacl) { 1711 unlink(acl_fname); 1712 mr_free(acl_fname); 1713 } 1714 1848 1715 log_msg(5, "Leaving"); 1849 1716 return (retval); … … 1881 1748 1882 1749 /** malloc add ***/ 1883 char *tmp;1884 1750 char *mds = NULL; 1885 char *command ;1886 char *afio_fname ;1887 char *filelist_fname ;1888 char *filelist_subset_fname ;1889 char *executable ;1751 char *command = NULL; 1752 char *afio_fname = NULL; 1753 char *filelist_fname = NULL; 1754 char *filelist_subset_fname = NULL; 1755 char *executable = NULL; 1890 1756 long matches = 0; 1891 1757 bool restore_this_fileset = FALSE; … … 1894 1760 assert(bkpinfo != NULL); 1895 1761 assert_string_is_neither_NULL_nor_zerolength(tarball_fname); 1896 malloc_string(filelist_subset_fname); 1897 malloc_string(filelist_fname); 1898 malloc_string(afio_fname); 1899 malloc_string(executable); 1900 malloc_string(command); 1901 malloc_string(tmp); 1902 filelist_subset_fname[0] = '\0'; 1762 1903 1763 /* to do it with a file... */ 1904 1764 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 1905 1765 mds = media_descriptor_string(bkpinfo->backup_media_type); 1906 sprintf(tmp, 1907 "Restoring from fileset #%ld (%ld KB) on %s #%d", 1766 log_msg(2, "Restoring from fileset #%ld (%ld KB) on %s #%d", 1908 1767 current_tarball_number, (long) size >> 10, mds, g_current_media_number); 1909 1768 mr_free(mds); 1910 1769 1911 log_msg(2, tmp);1912 1770 run_program_and_log_output("mkdir -p " MNT_RESTORING "/tmp", FALSE); 1913 1771 … … 1917 1775 * in afio or someting; oh darn.. OK, use tmpfs :-) * 1918 1776 ****************************************************************************/ 1919 filelist_fname[0] = filelist_subset_fname[0] = '\0'; 1920 sprintf(afio_fname, "/tmp/tmpfs/archive.tmp.%ld", 1921 current_tarball_number); 1922 sprintf(filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, 1923 current_tarball_number); 1924 sprintf(filelist_subset_fname, "%s/filelist-subset-%ld.tmp", 1925 bkpinfo->tmpdir, current_tarball_number); 1926 // sprintf(filelist_fname, "/tmp/tmpfs/temp-filelist.%ld", current_tarball_number); 1777 mr_asprintf(afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number); 1778 mr_asprintf(filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number); 1779 mr_asprintf(filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number); 1780 1927 1781 res = read_file_from_stream_to_file(afio_fname, size); 1928 1782 if (strstr(tarball_fname, ".star")) { … … 1933 1787 } 1934 1788 if (bkpinfo->compression_level == 0) { 1935 executable[0] = '\0';1789 mr_asprintf(executable, "%s", ""); 1936 1790 } else { 1937 1791 if (bkpinfo->use_star) { 1938 strcpy(executable, " -bz");1792 mr_asprintf(executable, "%s", " -bz"); 1939 1793 } else { 1940 sprintf(executable, "-P %s -Z", bkpinfo->zip_exe);1794 mr_asprintf(executable, "-P %s -Z", bkpinfo->zip_exe); 1941 1795 } 1942 1796 } … … 1949 1803 if (strstr(tarball_fname, ".star.")) { 1950 1804 use_star = TRUE; 1951 sprintf(command, "star -sparse -t file=%s %s", afio_fname, executable);1805 mr_asprintf(command, "star -sparse -t file=%s %s", afio_fname, executable); 1952 1806 } else { 1953 1807 use_star = FALSE; 1954 sprintf(command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, 1955 executable, afio_fname); 1956 } 1957 sprintf(command + strlen(command), " > %s 2>> %s", filelist_fname, 1958 MONDO_LOGFILE); 1808 mr_asprintf(command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname); 1809 } 1810 mr_strcat(command, " > %s 2>> %s", filelist_fname, MONDO_LOGFILE); 1959 1811 log_msg(1, "command = %s", command); 1960 1812 if (system(command)) { 1961 1813 log_msg(4, "Warning - error occurred while retrieving TOC"); 1962 1814 } 1815 mr_free(command); 1816 1963 1817 if ((matches = 1964 1818 save_filelist_entries_in_common(filelist_fname, filelist, … … 1970 1824 current_tarball_number); 1971 1825 } 1972 sprintf(tmp, "Skipping fileset %ld", current_tarball_number); 1973 log_msg(2, tmp); 1826 log_msg(2, "Skipping fileset %ld", current_tarball_number); 1974 1827 restore_this_fileset = FALSE; 1975 1828 } else { … … 1982 1835 1983 1836 // Concoct the call to star/afio to restore files 1984 if (strstr(tarball_fname, ".star.")) // star1985 {1986 sprintf(command, "star -sparse -x file=%s %s", afio_fname, executable);1837 if (strstr(tarball_fname, ".star.")) { 1838 // star 1839 mr_asprintf(command, "star -sparse -x file=%s %s", afio_fname, executable); 1987 1840 if (filelist) { 1988 sprintf(command + strlen(command), " list=%s", 1989 filelist_subset_fname); 1990 } 1991 } else // afio 1992 { 1993 sprintf(command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, 1994 executable); 1841 mr_strcat(command, " list=%s", filelist_subset_fname); 1842 } 1843 } else { 1844 // afio 1845 mr_asprintf(command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable); 1995 1846 if (filelist) { 1996 sprintf(command + strlen(command), " -w %s",1997 filelist_subset_fname);1998 }1999 sprintf(command + strlen(command), " %s", afio_fname);2000 }2001 sprintf(command + strlen(command), " 2>> %s", MONDO_LOGFILE);1847 mr_strcat(command, " -w %s", filelist_subset_fname); 1848 } 1849 mr_strcat(command, " %s", afio_fname); 1850 } 1851 mr_strcat(command, " 2>> %s", MONDO_LOGFILE); 1852 mr_free(executable); 2002 1853 2003 1854 // Call if IF there are files to restore (selectively/unconditionally) … … 2031 1882 log_msg(1, "NOT CALLING '%s'", command); 2032 1883 } 1884 mr_free(command); 2033 1885 2034 1886 if (does_file_exist("/PAUSE") && current_tarball_number >= 50) { … … 2038 1890 2039 1891 unlink(filelist_subset_fname); 1892 mr_free(filelist_subset_fname); 2040 1893 unlink(filelist_fname); 1894 mr_free(filelist_fname); 2041 1895 unlink(afio_fname); 2042 2043 paranoid_free(filelist_subset_fname); 2044 paranoid_free(filelist_fname); 2045 paranoid_free(afio_fname); 2046 paranoid_free(command); 2047 paranoid_free(tmp); 1896 mr_free(afio_fname); 1897 2048 1898 return (retval); 2049 1899 } … … 2065 1915 * @return 0 for success, nonzero for failure. 2066 1916 */ 2067 int 2068 restore_all_biggiefiles_from_CD(struct s_node *filelist) 2069 { 1917 int restore_all_biggiefiles_from_CD(struct s_node *filelist) { 1918 2070 1919 int retval = 0; 2071 1920 int res = 0; 2072 1921 long noof_biggiefiles, bigfileno = 0, total_slices; 2073 1922 /** malloc **/ 2074 char *tmp; 1923 char *tmp = NULL; 1924 char *tmp1 = NULL; 2075 1925 char *mds = NULL; 2076 1926 bool just_changed_cds = FALSE; 2077 char *xattr_fname ;2078 char *acl_fname ;2079 char *biggies_whose_EXATs_we_should_set ; // EXtended ATtributes1927 char *xattr_fname = NULL; 1928 char *acl_fname = NULL; 1929 char *biggies_whose_EXATs_we_should_set = NULL; // EXtended ATtributes 2080 1930 char *pathname_of_last_biggie_restored; 2081 1931 FILE *fbw = NULL; 2082 1932 2083 malloc_string(xattr_fname); 2084 malloc_string(acl_fname); 1933 malloc_string(pathname_of_last_biggie_restored); 2085 1934 malloc_string(tmp); 2086 malloc_string(biggies_whose_EXATs_we_should_set);2087 malloc_string(pathname_of_last_biggie_restored);2088 1935 assert(bkpinfo != NULL); 2089 1936 2090 sprintf(biggies_whose_EXATs_we_should_set, 2091 "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 1937 mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2092 1938 if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) { 2093 log_msg(1, "Warning - cannot openout %s", 2094 biggies_whose_EXATs_we_should_set); 1939 log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set); 2095 1940 } 2096 1941 2097 1942 read_cfg_var(g_mondo_cfg_file, "total-slices", tmp); 2098 1943 total_slices = atol(tmp); 2099 sprintf(tmp, "Reassembling large files "); 2100 mvaddstr_and_log_it(g_currentY, 0, tmp); 1944 mr_free(tmp); 1945 1946 mr_asprintf(tmp1, "Reassembling large files "); 1947 mvaddstr_and_log_it(g_currentY, 0, tmp1); 1948 mr_free(tmp1); 1949 2101 1950 if (length_of_file(BIGGIELIST) < 6) { 2102 1951 log_msg(1, "OK, no biggielist; not restoring biggiefiles"); … … 2105 1954 noof_biggiefiles = count_lines_in_file(BIGGIELIST); 2106 1955 if (noof_biggiefiles <= 0) { 2107 log_msg(2, 2108 "OK, no biggiefiles in biggielist; not restoring biggiefiles"); 1956 log_msg(2, "OK, no biggiefiles in biggielist; not restoring biggiefiles"); 2109 1957 return (0); 2110 1958 } 2111 sprintf(tmp, "OK, there are %ld biggiefiles in the archives", 2112 noof_biggiefiles); 2113 log_msg(2, tmp); 1959 log_msg(2, "OK, there are %ld biggiefiles in the archives", noof_biggiefiles); 2114 1960 2115 1961 open_progress_form("Reassembling large files", … … 2120 1966 log_msg(2, "Thinking about restoring bigfile %ld", bigfileno + 1); 2121 1967 if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) { 2122 log_msg(3, 2123 "...but its first slice isn't on this CD. Perhaps this was a selective restore?"); 1968 log_msg(3, "...but its first slice isn't on this CD. Perhaps this was a selective restore?"); 2124 1969 mds = media_descriptor_string(bkpinfo->backup_media_type); 2125 log_msg(3, "Cannot find bigfile #%ld 's first slice on %s #%d", 2126 bigfileno + 1, mds, 2127 g_current_media_number); 1970 log_msg(3, "Cannot find bigfile #%ld 's first slice on %s #%d", bigfileno + 1, mds, g_current_media_number); 2128 1971 log_msg(3, "Slicename would have been %s", 2129 1972 slice_fname(bigfileno, 0, ARCHIVES_PATH, "")); … … 2131 1974 if (just_changed_cds) { 2132 1975 just_changed_cds = FALSE; 2133 log_msg(3, 2134 "I'll continue to scan this CD for bigfiles to be restored."); 1976 log_msg(3, "I'll continue to scan this CD for bigfiles to be restored."); 2135 1977 } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 2136 1978 insist_on_this_cd_number(++g_current_media_number); 2137 sprintf(tmp, "Restoring from %s #%d", mds, 2138 g_current_media_number); 2139 log_to_screen(tmp); 1979 log_to_screen("Restoring from %s #%d", mds, g_current_media_number); 2140 1980 just_changed_cds = TRUE; 2141 1981 } else { 2142 1982 /* That big file doesn't exist, but the followings may */ 2143 1983 /* So we need to continue looping */ 2144 log_msg(2, "There was no bigfile #%ld. That's OK.", 2145 bigfileno + 1); 1984 log_msg(2, "There was no bigfile #%ld. That's OK.", bigfileno + 1); 2146 1985 log_msg(2, "I'm going to stop restoring bigfiles now."); 2147 1986 retval++; … … 2151 1990 } else { 2152 1991 just_changed_cds = FALSE; 2153 sprintf(tmp, "Restoring big file %ld", bigfileno + 1);2154 update_progress_form(tmp );2155 res =2156 1992 mr_asprintf(tmp1, "Restoring big file %ld", bigfileno + 1); 1993 update_progress_form(tmp1); 1994 mr_free(tmp1); 1995 res = restore_a_biggiefile_from_CD(bigfileno, filelist, pathname_of_last_biggie_restored); 2157 1996 log_it("%s",pathname_of_last_biggie_restored); 2158 1997 if (fbw && pathname_of_last_biggie_restored[0]) { … … 2168 2007 fclose(fbw); 2169 2008 if (g_getfattr) { 2170 sprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);2009 mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2171 2010 if (length_of_file(xattr_fname) > 0) { 2172 2011 set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname); 2173 2012 } 2013 mr_free(xattr_fname); 2174 2014 } 2175 2015 if (g_getfacl) { 2176 sprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);2016 mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2177 2017 if (length_of_file(acl_fname) > 0) { 2178 2018 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); 2179 2019 } 2180 } 2181 } 2020 mr_free(acl_fname); 2021 } 2022 } 2023 mr_free(biggies_whose_EXATs_we_should_set); 2024 2182 2025 if (does_file_exist("/PAUSE")) { 2183 popup_and_OK 2184 ("Press ENTER to go on. Delete /PAUSE to stop these pauses."); 2026 popup_and_OK("Press ENTER to go on. Delete /PAUSE to stop these pauses."); 2185 2027 } 2186 2028 close_progress_form(); … … 2190 2032 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2191 2033 } 2192 paranoid_free(xattr_fname);2193 paranoid_free(acl_fname);2194 paranoid_free(tmp);2195 paranoid_free(biggies_whose_EXATs_we_should_set);2196 2034 paranoid_free(pathname_of_last_biggie_restored); 2197 2035 return (retval); … … 2220 2058 int res; 2221 2059 int attempts; 2222 long current_tarball_number = 0 ;2060 long current_tarball_number = 0L; 2223 2061 long max_val; 2224 2062 /**malloc ***/ 2063 char *mds = NULL; 2225 2064 char *tmp = NULL; 2226 char *mds = NULL;2227 2065 char *tmp1 = NULL; 2228 char *tarball_fname; 2229 char *progress_str; 2230 char *comment; 2066 char *tarball_fname = NULL; 2067 char *progress_str = NULL; 2068 2069 assert(bkpinfo != NULL); 2231 2070 2232 2071 malloc_string(tmp); 2233 malloc_string(tarball_fname);2234 malloc_string(progress_str);2235 malloc_string(comment);2236 2237 assert(bkpinfo != NULL);2238 2239 2072 mvaddstr_and_log_it(g_currentY, 0, "Restoring from archives"); 2240 log_msg(2, 2241 "Insisting on 1st media, so that I can have a look at LAST-FILELIST-NUMBER"); 2073 log_msg(2, "Insisting on 1st media, so that I can have a look at LAST-FILELIST-NUMBER"); 2242 2074 if (g_current_media_number != 1) { 2243 2075 log_msg(3, "OK, that's jacked up."); … … 2250 2082 2251 2083 mds = media_descriptor_string(bkpinfo->backup_media_type); 2252 sprintf(progress_str, "Restoring from %s #%d", mds, g_current_media_number);2084 mr_asprintf(progress_str, "Restoring from %s #%d", mds, g_current_media_number); 2253 2085 2254 2086 log_to_screen(progress_str); … … 2260 2092 insist_on_this_cd_number(g_current_media_number); 2261 2093 update_progress_form(progress_str); 2262 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", 2263 current_tarball_number); 2094 mr_free(progress_str); 2095 2096 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number); 2264 2097 if (!does_file_exist(tarball_fname)) { 2265 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.gz",2266 2098 mr_free(tarball_fname); 2099 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number); 2267 2100 } 2268 2101 if (!does_file_exist(tarball_fname)) { 2269 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo",2270 2102 mr_free(tarball_fname); 2103 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzma", current_tarball_number); 2271 2104 } 2272 2105 if (!does_file_exist(tarball_fname)) { 2273 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.",2274 2106 mr_free(tarball_fname); 2107 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number); 2275 2108 } 2276 2109 if (!does_file_exist(tarball_fname)) { 2277 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.bz2",2278 2110 mr_free(tarball_fname); 2111 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number); 2279 2112 } 2280 2113 if (!does_file_exist(tarball_fname)) { 2281 sprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.", 2282 current_tarball_number); 2114 mr_free(tarball_fname); 2115 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number); 2116 } 2117 if (!does_file_exist(tarball_fname)) { 2118 mr_free(tarball_fname); 2119 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number); 2283 2120 } 2284 2121 if (!does_file_exist(tarball_fname)) { … … 2286 2123 log_to_screen 2287 2124 ("No tarballs. Strange. Maybe you only backed up freakin' big files?"); 2125 mr_free(tarball_fname); 2288 2126 return (0); 2289 2127 } … … 2295 2133 } 2296 2134 g_current_media_number++; 2297 sprintf(progress_str, "Restoring from %s #%d", 2298 media_descriptor_string(bkpinfo->backup_media_type), 2299 g_current_media_number); 2135 mr_asprintf(progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number); 2300 2136 log_to_screen(progress_str); 2301 2137 } else { 2302 sprintf(progress_str, "Restoring from fileset #%ld on %s #%d", 2303 current_tarball_number, mds, g_current_media_number); 2304 // log_msg(3, "progress_str = %s", progress_str); 2305 for (res = 999, attempts = 0; attempts < 3 && res != 0; 2306 attempts++) { 2307 res = 2308 restore_a_tarball_from_CD(tarball_fname, 2309 current_tarball_number, 2310 filelist); 2311 } 2312 mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ", 2313 mds, g_current_media_number, current_tarball_number); 2138 mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number); 2139 for (res = 999, attempts = 0; attempts < 3 && res != 0; attempts++) { 2140 res = restore_a_tarball_from_CD(tarball_fname, current_tarball_number, filelist); 2141 } 2142 mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number); 2314 2143 if (res) { 2315 2144 mr_strcat(tmp1, "reported errors"); … … 2322 2151 mr_strcat(tmp1, " (%d attempts) - review logs", attempts); 2323 2152 } 2324 strcpy(comment, tmp1);2325 paranoid_free(tmp1);2326 2153 if (attempts > 1) { 2327 log_to_screen(comment); 2328 } 2154 log_to_screen(tmp1); 2155 } 2156 mr_free(tmp1); 2329 2157 2330 2158 retval += res; … … 2332 2160 g_current_progress++; 2333 2161 } 2162 mr_free(tarball_fname); 2163 2334 2164 /* Now we need to umount the current media to have the next mounted by insist_on_this_cd_number */ 2335 2165 /* run_program_and_log_output("umount " MNT_CDROM, FALSE); */ 2336 2166 } 2337 2167 mr_free(mds); 2168 mr_free(progress_str); 2338 2169 2339 2170 close_progress_form(); … … 2343 2174 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2344 2175 } 2345 paranoid_free(tarball_fname);2346 paranoid_free(progress_str);2347 paranoid_free(comment);2348 2176 2349 2177 return (retval); … … 2375 2203 2376 2204 /** malloc add ****/ 2377 char *tmp ;2205 char *tmp = NULL; 2378 2206 char *biggie_fname; 2379 2207 char *biggie_cksum; 2380 char *xattr_fname ;2381 char *acl_fname ;2208 char *xattr_fname = NULL; 2209 char *acl_fname = NULL; 2382 2210 char *p; 2383 2211 char *pathname_of_last_biggie_restored; 2384 char *biggies_whose_EXATs_we_should_set ; // EXtended ATtributes2212 char *biggies_whose_EXATs_we_should_set = NULL; // EXtended ATtributes 2385 2213 long long biggie_size; 2386 2214 FILE *fbw = NULL; … … 2389 2217 malloc_string(biggie_fname); 2390 2218 malloc_string(biggie_cksum); 2391 malloc_string(xattr_fname);2392 malloc_string(acl_fname);2393 malloc_string(biggies_whose_EXATs_we_should_set);2394 2219 malloc_string(pathname_of_last_biggie_restored); 2395 2220 assert(bkpinfo != NULL); … … 2398 2223 2399 2224 total_slices = atol(tmp); 2400 sprintf(tmp, "Reassembling large files "); 2225 2401 2226 if (g_getfattr) { 2402 sprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);2227 mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2403 2228 } 2404 2229 if (g_getfacl) { 2405 sprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2406 } 2407 mvaddstr_and_log_it(g_currentY, 0, tmp); 2408 sprintf(biggies_whose_EXATs_we_should_set, 2409 "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2230 mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir); 2231 } 2232 mr_asprintf(tmp1, "Reassembling large files "); 2233 mvaddstr_and_log_it(g_currentY, 0, tmp1); 2234 mr_free(tmp1); 2235 2236 mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir); 2410 2237 if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) { 2411 log_msg(1, "Warning - cannot openout %s", 2412 biggies_whose_EXATs_we_should_set); 2413 } 2414 // get xattr and acl files if they're there 2415 res = 2416 read_header_block_from_stream(&biggie_size, biggie_fname, 2417 &ctrl_chr); 2238 log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set); 2239 } 2240 2241 // get xattr and acl files if they're there 2242 res = read_header_block_from_stream(&biggie_size, biggie_fname, &ctrl_chr); 2418 2243 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 2419 res = read_EXAT_files_from_tape(&biggie_size, biggie_fname, 2420 &ctrl_chr, xattr_fname, acl_fname); 2244 res = read_EXAT_files_from_tape(&biggie_size, biggie_fname, &ctrl_chr, xattr_fname, acl_fname); 2421 2245 } 2422 2246 2423 2247 noof_biggiefiles = atol(biggie_fname); 2424 sprintf(tmp, "OK, there are %ld biggiefiles in the archives", 2425 noof_biggiefiles); 2426 log_msg(2, tmp); 2248 log_msg(2, "OK, there are %ld biggiefiles in the archives", noof_biggiefiles); 2427 2249 open_progress_form("Reassembling large files", 2428 2250 "I am now reassembling all the large files.", … … 2447 2269 p++; 2448 2270 } 2449 sprintf(tmp, "Restoring big file %ld (%lld K)",2450 current_bigfile_number + 1, biggie_size / 1024);2451 update_progress_form(tmp);2271 mr_asprintf(tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024); 2272 update_progress_form(tmp1); 2273 mr_free(tmp1); 2452 2274 res = restore_a_biggiefile_from_stream(biggie_fname, 2453 2275 current_bigfile_number, … … 2467 2289 if (current_bigfile_number != noof_biggiefiles 2468 2290 && noof_biggiefiles != 0) { 2469 sprintf(tmp, "Warning - bigfileno=%ld but noof_biggiefiles=%ld\n", 2470 current_bigfile_number, noof_biggiefiles); 2471 } else { 2472 sprintf(tmp, 2473 "%ld biggiefiles in biggielist.txt; %ld biggiefiles processed today.", 2474 noof_biggiefiles, current_bigfile_number); 2475 } 2476 log_msg(1, tmp); 2291 log_msg(1, "Warning - bigfileno=%ld but noof_biggiefiles=%ld\n", current_bigfile_number, noof_biggiefiles); 2292 } else { 2293 log_msg(1, "%ld biggiefiles in biggielist.txt; %ld biggiefiles processed today.", noof_biggiefiles, current_bigfile_number); 2294 } 2477 2295 2478 2296 if (fbw) { … … 2482 2300 if (g_getfattr) { 2483 2301 if (length_of_file(xattr_fname) > 0) { 2484 log_msg(1, "set_fattr_List(%s,%s)", 2485 biggies_whose_EXATs_we_should_set, xattr_fname); 2486 set_fattr_list(biggies_whose_EXATs_we_should_set, 2487 xattr_fname); 2302 log_msg(1, "set_fattr_List(%s,%s)", biggies_whose_EXATs_we_should_set, xattr_fname); 2303 set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname); 2488 2304 } 2489 2305 } 2490 2306 if (g_getfacl) { 2491 2307 if (length_of_file(acl_fname) > 0) { 2492 log_msg(1, "set_acl_list(%s,%s)", 2493 biggies_whose_EXATs_we_should_set, acl_fname); 2308 log_msg(1, "set_acl_list(%s,%s)", biggies_whose_EXATs_we_should_set, acl_fname); 2494 2309 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); 2495 2310 } … … 2499 2314 } 2500 2315 } 2316 mr_free(xattr_fname); 2317 mr_free(acl_fname); 2318 mr_free(biggies_whose_EXATs_we_should_set); 2319 2501 2320 if (does_file_exist("/PAUSE")) { 2502 2321 popup_and_OK … … 2510 2329 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 2511 2330 } 2512 paranoid_free(biggies_whose_EXATs_we_should_set);2513 2331 paranoid_free(pathname_of_last_biggie_restored); 2514 2332 paranoid_free(biggie_fname); 2515 2333 paranoid_free(biggie_cksum); 2516 paranoid_free(xattr_fname);2517 paranoid_free(acl_fname);2518 2334 paranoid_free(tmp); 2519 2335 return (retval); … … 2539 2355 * @return 0 for success, or the number of filesets that failed. 2540 2356 */ 2541 int 2542 restore_all_tarballs_from_stream(struct s_node *filelist) 2357 int restore_all_tarballs_from_stream(struct s_node *filelist) 2543 2358 { 2544 2359 int retval = 0; … … 2549 2364 2550 2365 /** malloc **/ 2551 char *tmp ;2366 char *tmp = NULL; 2552 2367 char *mds = NULL; 2553 char *progress_str ;2368 char *progress_str = NULL; 2554 2369 char *tmp_fname; 2555 char *xattr_fname ;2556 char *acl_fname ;2370 char *xattr_fname = NULL; 2371 char *acl_fname = NULL; 2557 2372 2558 2373 long long tmp_size; 2559 2374 2560 2375 malloc_string(tmp); 2561 malloc_string(progress_str);2562 2376 malloc_string(tmp_fname); 2563 2377 assert(bkpinfo != NULL); 2564 malloc_string(xattr_fname);2565 malloc_string(acl_fname);2566 2378 mvaddstr_and_log_it(g_currentY, 0, "Restoring from archives"); 2567 2379 read_cfg_var(g_mondo_cfg_file, "last-filelist-number", tmp); … … 2574 2386 run_program_and_log_output("pwd", 5); 2575 2387 2576 sprintf(progress_str, "Restoring from media #%d", 2577 g_current_media_number); 2388 mr_asprintf(progress_str, "Restoring from media #%d", g_current_media_number); 2578 2389 log_to_screen(progress_str); 2579 2390 open_progress_form("Restoring from archives", … … 2597 2408 update_progress_form(progress_str); 2598 2409 if (g_getfattr) { 2599 sprintf(xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, 2600 current_afioball_number); 2410 mr_asprintf(xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number); 2601 2411 unlink(xattr_fname); 2602 2412 } 2603 2413 if (g_getfacl) { 2604 sprintf(acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, 2605 current_afioball_number); 2414 mr_asprintf(acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number); 2606 2415 unlink(acl_fname); 2607 2416 } 2608 2417 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 2609 2418 log_it("Reading EXAT files from tape"); 2610 res = read_EXAT_files_from_tape(&tmp_size, tmp_fname, 2611 &ctrl_chr, xattr_fname, 2612 acl_fname); 2419 res = read_EXAT_files_from_tape(&tmp_size, tmp_fname, &ctrl_chr, xattr_fname, acl_fname); 2613 2420 } 2614 2421 if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 2615 2422 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); 2616 2423 } 2617 sprintf(tmp, 2618 "Restoring from fileset #%ld (name=%s, size=%ld K)", 2619 current_afioball_number, tmp_fname, (long) tmp_size >> 10); 2620 res = 2621 restore_a_tarball_from_stream(tmp_fname, 2622 current_afioball_number, 2623 filelist, tmp_size, xattr_fname, 2624 acl_fname); 2424 log_msg(4, "Restoring from fileset #%ld (name=%s, size=%ld K)", current_afioball_number, tmp_fname, (long) tmp_size >> 10); 2425 res = restore_a_tarball_from_stream(tmp_fname, current_afioball_number, filelist, tmp_size, xattr_fname, acl_fname); 2625 2426 retval += res; 2626 2427 if (res) { 2627 sprintf(tmp, "Fileset %ld - errors occurred", 2628 current_afioball_number); 2629 log_to_screen(tmp); 2428 log_to_screen("Fileset %ld - errors occurred", current_afioball_number); 2630 2429 } 2631 2430 res = … … 2638 2437 g_current_progress++; 2639 2438 mds = media_descriptor_string(bkpinfo->backup_media_type), 2640 sprintf(progress_str, "Restoring from fileset #%ld on %s #%d", 2641 current_afioball_number, mds,2642 2439 2440 mr_free(progress_str); 2441 mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number); 2643 2442 mr_free(mds); 2644 res = 2645 read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr); 2443 res = read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr); 2646 2444 if (g_getfattr) { 2647 2445 unlink(xattr_fname); … … 2651 2449 } 2652 2450 } // next 2451 mr_free(progress_str); 2452 if (g_getfattr) { 2453 mr_free(xattr_fname); 2454 } 2455 if (g_getfacl) { 2456 mr_free(acl_fname); 2457 } 2458 2653 2459 log_msg(1, "All done with afioballs"); 2654 2460 close_progress_form(); … … 2659 2465 } 2660 2466 paranoid_free(tmp); 2661 paranoid_free(progress_str);2662 2467 paranoid_free(tmp_fname); 2663 paranoid_free(xattr_fname);2664 paranoid_free(acl_fname);2665 2468 return (retval); 2666 2469 } … … 2689 2492 char *cwd; 2690 2493 char *newpath; 2691 char *tmp ;2494 char *tmp = NULL; 2692 2495 assert(bkpinfo != NULL); 2693 2496 2694 2497 malloc_string(cwd); 2695 2498 malloc_string(newpath); 2696 malloc_string(tmp);2697 2499 log_msg(2, "restore_everything() --- starting"); 2698 2500 g_current_media_number = 1; … … 2700 2502 // FIXME 2701 2503 } 2702 sprintf(tmp, "mkdir -p %s", bkpinfo->restore_path);2504 mr_asprintf(tmp, "mkdir -p %s", bkpinfo->restore_path); 2703 2505 run_program_and_log_output(tmp, FALSE); 2506 mr_free(tmp); 2507 2704 2508 log_msg(1, "Changing dir to %s", bkpinfo->restore_path); 2705 2509 if (chdir(bkpinfo->restore_path)) { … … 2755 2559 paranoid_free(cwd); 2756 2560 paranoid_free(newpath); 2757 paranoid_free(tmp);2758 2561 return (resA + resB); 2759 2562 } … … 2776 2579 { 2777 2580 log_msg(0, "-------------- Mondo Restore v%s -------------", PACKAGE_VERSION); 2778 log_msg(0, 2779 "DON'T PANIC! Mondorestore logs almost everything, so please "); 2780 log_msg(0, 2781 "don't break out in a cold sweat just because you see a few "); 2782 log_msg(0, 2783 "error messages in the log. Read them; analyze them; see if "); 2784 log_msg(0, 2785 "they are significant; above all, verify your backups! Please"); 2786 log_msg(0, 2787 "attach a compressed copy of this log to any e-mail you send "); 2788 log_msg(0, 2789 "to the Mondo mailing list when you are seeking technical "); 2790 log_msg(0, 2791 "support. Without it, we can't help you. - DevTeam"); 2792 log_msg(0, 2793 "------------------------------------------------------------"); 2794 log_msg(0, 2795 "BTW, despite (or perhaps because of) the wealth of messages,"); 2796 log_msg(0, 2797 "some users are inclined to stop reading this log. If Mondo "); 2798 log_msg(0, 2799 "stopped for some reason, chances are it's detailed here. "); 2800 log_msg(0, 2801 "More than likely there's a message at the very end of this "); 2802 log_msg(0, 2803 "log that will tell you what is wrong. Please read it! "); 2804 log_msg(0, 2805 "------------------------------------------------------------"); 2581 log_msg(0, "DON'T PANIC! Mondorestore logs almost everything, so please "); 2582 log_msg(0, "don't break out in a cold sweat just because you see a few "); 2583 log_msg(0, "error messages in the log. Read them; analyze them; see if "); 2584 log_msg(0, "they are significant; above all, verify your backups! Please"); 2585 log_msg(0, "attach a compressed copy of this log to any e-mail you send "); 2586 log_msg(0, "to the Mondo mailing list when you are seeking technical "); 2587 log_msg(0, "support. Without it, we can't help you. - DevTeam"); 2588 log_msg(0, "------------------------------------------------------------"); 2589 log_msg(0, "BTW, despite (or perhaps because of) the wealth of messages,"); 2590 log_msg(0, "some users are inclined to stop reading this log. If Mondo "); 2591 log_msg(0, "stopped for some reason, chances are it's detailed here. "); 2592 log_msg(0, "More than likely there's a message at the very end of this "); 2593 log_msg(0, "log that will tell you what is wrong. Please read it! "); 2594 log_msg(0, "------------------------------------------------------------"); 2806 2595 } 2807 2596 … … 2818 2607 int retval = 0; 2819 2608 int res; 2820 // int c; 2821 char *tmp; 2609 char *tmp = NULL; 2822 2610 2823 2611 struct mountlist_itself *mountlist; 2824 2612 struct raidlist_itself *raidlist; 2825 2613 struct s_node *filelist; 2826 char *a, *b; 2614 char *tmp1 = NULL; 2615 char *tmp2 = NULL; 2827 2616 bool run_postnuke = FALSE; 2828 2617 … … 2838 2627 2839 2628 g_loglevel = DEFAULT_MR_LOGLEVEL; 2840 malloc_string(tmp);2841 2629 2842 2630 /* Configure global variables */ … … 2863 2651 } 2864 2652 2653 /* Init GUI */ 2654 setup_newt_stuff(); /* call newtInit and setup screen log */ 2655 2865 2656 malloc_libmondo_global_strings(); 2866 2657 2867 2658 strcpy(g_mondo_home, 2868 2659 call_program_and_get_last_line_of_output("which mondorestore")); 2869 /*2870 sprintf(g_tmpfs_mountpt, "/tmp/tmpfs");2871 make_hole_for_dir(g_tmpfs_mountpt);2872 */2873 2660 g_current_media_number = 1; // precaution 2874 2661 2875 2662 run_program_and_log_output("mkdir -p " MNT_CDROM, FALSE); 2876 2663 2877 malloc_string(a);2878 malloc_string(b);2879 2664 setup_MR_global_filenames(); // malloc() and set globals, using bkpinfo->tmpdir etc. 2880 2665 bkpinfo->backup_media_type = none; // in case boot disk was made for one backup type but user wants to restore from another backup type … … 2897 2682 2898 2683 /* Backup original mountlist.txt */ 2899 sprintf(tmp, "%s.orig", g_mountlist_fname);2684 mr_asprintf(tmp, "%s.orig", g_mountlist_fname); 2900 2685 if (!does_file_exist(g_mountlist_fname)) { 2901 log_msg(2, 2902 "%ld: Warning - g_mountlist_fname (%s) does not exist yet", 2903 __LINE__, g_mountlist_fname); 2686 log_msg(2, "%ld: Warning - g_mountlist_fname (%s) does not exist yet", __LINE__, g_mountlist_fname); 2904 2687 } else if (!does_file_exist(tmp)) { 2905 sprintf(tmp, "cp -f %s %s.orig", g_mountlist_fname,2906 2688 mr_free(tmp); 2689 mr_asprintf(tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname); 2907 2690 run_program_and_log_output(tmp, FALSE); 2908 2691 } 2692 mr_free(tmp); 2909 2693 2910 2694 /* Init directories */ … … 2912 2696 make_hole_for_dir("/tmp/tmpfs"); /* just in case... */ 2913 2697 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); 2914 /*2915 run_program_and_log_output("ln -sf /var/log/mondo-archive.log /tmp/mondorestore.log",2916 FALSE);2917 */2918 2698 2919 2699 run_program_and_log_output("rm -Rf /tmp/tmpfs/mondo.tmp.*", FALSE); 2920 2700 2921 /* Init GUI */2922 setup_newt_stuff(); /* call newtInit and setup screen log */2923 2701 welcome_to_mondorestore(); 2924 2702 if (bkpinfo->disaster_recovery) { … … 2954 2732 } 2955 2733 2956 if (argc >= 2 && strcmp(argv[1], "--pih") == 0) {2957 if (system("mount | grep cdrom 2> /dev/null > /dev/null")) {2958 paranoid_system("mount " MNT_CDROM);2959 }2960 bkpinfo->compression_level = 1;2961 g_current_media_number = 2;2962 strcpy(bkpinfo->restore_path, "/tmp/TESTING");2963 bkpinfo->backup_media_type = dvd;2964 open_progress_form("Reassembling /dev/hda1",2965 "Shark is a bit of a silly person.",2966 "Please wait. This may take some time.",2967 "", 1999);2968 paranoid_system("rm -Rf /tmp/*pih*");2969 2970 restore_a_biggiefile_from_CD(42, NULL, tmp);2971 }2972 2973 2734 if (argc == 5 && strcmp(argv[1], "--common") == 0) { 2974 2735 g_loglevel = 6; … … 2981 2742 // BERLIOS: /usr/lib ??? 2982 2743 toggle_path_selection(filelist, "/usr/share", TRUE); 2983 // show_filelist(filelist);2984 2744 save_filelist(filelist, "/tmp/out.txt"); 2985 // finish(0); 2986 // toggle_path_selection (filelist, "/root/stuff", TRUE); 2987 strcpy(a, argv[3]); 2988 strcpy(b, argv[4]); 2989 2990 res = save_filelist_entries_in_common(a, filelist, b, FALSE); 2745 mr_asprintf(tmp1, "%s", argv[3]); 2746 mr_asprintf(tmp2, "%s", argv[4]); 2747 2748 res = save_filelist_entries_in_common(tmp1, filelist, tmp2, FALSE); 2749 mr_free(tmp1); 2750 mr_free(tmp2); 2751 2991 2752 free_filelist(filelist); 2992 2753 printf("res = %d", res); … … 3096 2857 log_msg(2, "Still here. Yay."); 3097 2858 if ((strlen(bkpinfo->tmpdir) > 0) && (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL)) { 3098 sprintf(tmp, "rm -Rf %s/*", bkpinfo->tmpdir);2859 mr_asprintf(tmp, "rm -Rf %s/*", bkpinfo->tmpdir); 3099 2860 run_program_and_log_output(tmp, FALSE); 2861 mr_free(tmp); 3100 2862 } 3101 2863 unmount_boot_if_necessary(); /* for Gentoo users */ … … 3115 2877 // BCO:To be reviewed 3116 2878 if ((bkpinfo->restore_mode == compare) || (bkpinfo->restore_mode == nuke)) { 3117 if (bkpinfo->backup_media_type == netfs 3118 && !is_this_device_mounted(bkpinfo->netfs_mount)) { 2879 if ((bkpinfo->backup_media_type == netfs) && bkpinfo->netfs_mount && !is_this_device_mounted(bkpinfo->netfs_mount)) { 3119 2880 log_msg(1, "Mounting remote %s dir", bkpinfo->netfs_proto); 3120 2881 sprintf(bkpinfo->isodir, "/tmp/isodir"); … … 3122 2883 if (strstr(bkpinfo->netfs_proto, "sshfs")) { 3123 2884 if (bkpinfo->netfs_user) { 3124 sprintf(tmp, "sshfs -o ro %s@%s /tmp/isodir", 3125 bkpinfo->netfs_user,bkpinfo->netfs_mount); 2885 mr_asprintf(tmp, "sshfs -o ro %s@%s /tmp/isodir", bkpinfo->netfs_user,bkpinfo->netfs_mount); 3126 2886 } else { 3127 sprintf(tmp, "sshfs -o ro %s /tmp/isodir", 3128 bkpinfo->netfs_mount); 2887 mr_asprintf(tmp, "sshfs -o ro %s /tmp/isodir", bkpinfo->netfs_mount); 3129 2888 } 3130 2889 } else { 3131 2890 if (strstr(bkpinfo->netfs_proto, "smbfs")) { 3132 2891 if (bkpinfo->netfs_user) { 3133 sprintf(tmp, "mount -t cifs %s /tmp/isodir -o user=%s,nolock,ro ", 3134 bkpinfo->netfs_mount,bkpinfo->netfs_user); 2892 mr_asprintf(tmp, "mount -t cifs %s /tmp/isodir -o user=%s,nolock,ro ", bkpinfo->netfs_mount,bkpinfo->netfs_user); 3135 2893 } else { 3136 sprintf(tmp, "mount -t cifs %s /tmp/isodir -o nolock,ro ", 3137 bkpinfo->netfs_mount); 2894 mr_asprintf(tmp, "mount -t cifs %s /tmp/isodir -o nolock,ro ", bkpinfo->netfs_mount); 3138 2895 } 3139 2896 } else { 3140 2897 if (bkpinfo->netfs_user) { 3141 sprintf(tmp, "mount %s@%s -o nolock,ro /tmp/isodir", 3142 bkpinfo->netfs_user,bkpinfo->netfs_mount); 2898 mr_asprintf(tmp, "mount %s@%s -o nolock,ro /tmp/isodir", bkpinfo->netfs_user,bkpinfo->netfs_mount); 3143 2899 } else { 3144 sprintf(tmp, "mount %s -o nolock,ro /tmp/isodir", 3145 bkpinfo->netfs_mount); 2900 mr_asprintf(tmp, "mount %s -o nolock,ro /tmp/isodir", bkpinfo->netfs_mount); 3146 2901 } 3147 2902 } 3148 2903 } 3149 2904 run_program_and_log_output(tmp, 1); 2905 mr_free(tmp); 3150 2906 } 3151 2907 } 3152 2908 3153 2909 if (retval) { 3154 log_to_screen 3155 ("Warning - load_raidtab_into_raidlist returned an error"); 2910 log_to_screen("Warning - load_raidtab_into_raidlist returned an error"); 3156 2911 } 3157 2912 … … 3205 2960 "Run complete. Please remove media and reboot."); 3206 2961 } else { 3207 run_program_and_log_output("sync", FALSE);2962 sync(); 3208 2963 if (is_this_device_mounted(MNT_CDROM)) { 3209 2964 run_program_and_log_output("umount -d " MNT_CDROM, FALSE); … … 3242 2997 } else { 3243 2998 log_msg(1, "Re-mounted partitions for post-nuke stuff"); 3244 sprintf(tmp, "post-nuke %s %d", bkpinfo->restore_path, 3245 retval); 2999 mr_asprintf(tmp, "post-nuke %s %d", bkpinfo->restore_path, retval); 3246 3000 log_msg(2, "Calling '%s'", tmp); 3247 3001 if ((res = run_program_and_log_output(tmp, 0))) { 3248 3002 log_OS_error(tmp); 3249 3003 } 3004 mr_free(tmp); 3250 3005 log_msg(1, "post-nuke returned w/ res=%d", res); 3251 3006 } … … 3263 3018 set_signals(FALSE); 3264 3019 log_to_screen("Restore log (%s) copied to /var/log on your hard disk", MONDO_LOGFILE); 3265 sprintf(tmp, 3266 "Mondo-restore is exiting (retval=%d) ", 3267 retval); 3268 log_to_screen(tmp); 3269 sprintf(tmp, "umount -d %s", bkpinfo->isodir); 3020 log_to_screen("Mondo-restore is exiting (retval=%d) ", retval); 3021 3022 mr_asprintf(tmp, "umount -d %s", bkpinfo->isodir); 3270 3023 run_program_and_log_output(tmp, 5); 3024 mr_free(tmp); 3025 3271 3026 paranoid_free(mountlist); 3272 3027 paranoid_free(raidlist); … … 3275 3030 } // for b0rken distros 3276 3031 if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) { 3277 sprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir);3032 mr_asprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir); 3278 3033 paranoid_system(tmp); 3034 mr_free(tmp); 3279 3035 } 3280 3036 paranoid_MR_finish(retval); // frees global stuff plus bkpinfo 3281 3037 free_libmondo_global_strings(); // it's fine to have this here :) really :) 3282 paranoid_free(a);3283 paranoid_free(b);3284 paranoid_free(tmp);3285 3038 3286 3039 unlink("/tmp/filelist.full");
Note:
See TracChangeset
for help on using the changeset viewer.