Changeset 2327 in MondoRescue
- Timestamp:
- Aug 18, 2009, 3:20:37 PM (16 years ago)
- Location:
- branches/2.2.10/mondo/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2326 r2327 2873 2873 biggiestruct.use_ntfsprog = use_ntfsprog; 2874 2874 optimal_set_size = bkpinfo->optimal_set_size; 2875 if (is_this_file_compressed(biggie_filename) 2876 || bkpinfo->compression_level == 0) { 2875 if (is_this_file_compressed(biggie_filename) || bkpinfo->compression_level == 0) { 2877 2876 mr_asprintf(suffix, "%s", ""); 2878 // log_it("%s is indeed compressed :-)", filename);2879 2877 should_I_compress_slices = FALSE; 2880 2878 } else { -
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2326 r2327 1170 1170 1171 1171 if (flag_set['x']) { 1172 strncpy(bkpinfo->image_devs, flag_val['x'], MAX_STR_LEN / 4);1172 mr_asprintf(bkpinfo->image_devs, flag_val['x']); 1173 1173 if ((run_program_and_log_output("which ntfsclone", 2)) && (! bkpinfo->restore_data)) { 1174 1174 fatal_error("Please install ntfsprogs package/tarball."); -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2326 r2327 1894 1894 finish(1); 1895 1895 } 1896 strncpy(bkpinfo->image_devs, p, MAX_STR_LEN / 4);1897 mr_free(p);1896 mr_free(bkpinfo->image_devs); 1897 bkpinfo->image_devs = p; 1898 1898 } 1899 1899 … … 1973 1973 log_it("media size = %ld", bkpinfo->media_size[1]); 1974 1974 log_it("media type = %s", bkptype_to_string(bkpinfo->backup_media_type)); 1975 log_it("prefix = %s", bkpinfo->prefix); 1975 if (bkpinfo->prefix) { 1976 log_it("prefix = %s", bkpinfo->prefix); 1977 } 1976 1978 log_it("compression = %ld", bkpinfo->compression_level); 1977 log_it("include_paths = '%s'", bkpinfo->include_paths); 1978 log_it("exclude_paths = '%s'", bkpinfo->exclude_paths); 1979 if (bkpinfo->include_paths) { 1980 log_it("include_paths = '%s'", bkpinfo->include_paths); 1981 } 1982 if (bkpinfo->exclude_paths) { 1983 log_it("exclude_paths = '%s'", bkpinfo->exclude_paths); 1984 } 1979 1985 log_it("scratchdir = '%s'", bkpinfo->scratchdir); 1980 1986 log_it("tmpdir = '%s'", bkpinfo->tmpdir); 1981 log_it("image_devs = '%s'", bkpinfo->image_devs); 1987 if (bkpinfo->image_devs) { 1988 log_it("image_devs = '%s'", bkpinfo->image_devs); 1989 } 1982 1990 log_it("boot_device = '%s' (loader=%c)", bkpinfo->boot_device, bkpinfo->boot_loader); 1983 1991 if (bkpinfo->media_size[0] < 0) { -
branches/2.2.10/mondo/src/common/libmondo-filelist.c
r2325 r2327 87 87 88 88 /*@ pointers ********************** */ 89 char *ptr ;89 char *ptr = NULL; 90 90 FILE *fout; 91 91 … … 117 117 mr_free(tempfile); 118 118 119 log_it(bkpinfo->image_devs); 120 121 ptr = bkpinfo->image_devs; 122 123 malloc_string(dev); 124 while (ptr && *ptr) { 125 strcpy(dev, ptr); 126 log_it("Examining imagedev %s", dev); 127 for (i = 0; i < (int) strlen(dev) && dev[i] != ' '; i++); 128 dev[i] = '\0'; 129 if (!strlen(dev)) { 130 continue; 131 } 132 fprintf(fout, "%s\n", dev); 133 log_it("Adding '%s' to biggielist", dev); 134 if ((ptr = strchr(ptr, ' '))) { 135 ptr++; 119 if (bkpinfo->image_devs) { 120 log_it("image_devs : %s", bkpinfo->image_devs); 121 122 ptr = bkpinfo->image_devs; 123 124 while (ptr && *ptr) { 125 mr_asprintf(dev, "%s", ptr); 126 log_it("Examining imagedev %s", dev); 127 for (i = 0; i < (int) strlen(dev) && dev[i] != ' '; i++); 128 dev[i] = '\0'; 129 if (!strlen(dev)) { 130 mr_free(dev); 131 continue; 132 } 133 fprintf(fout, "%s\n", dev); 134 log_it("Adding '%s' to biggielist", dev); 135 if ((ptr = strchr(ptr, ' '))) { 136 ptr++; 137 } 138 mr_free(dev); 136 139 } 137 140 } … … 139 142 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 140 143 141 paranoid_free(dev);142 144 return (retval); 143 145 } 144 145 146 146 147 -
branches/2.2.10/mondo/src/common/libmondo-files.c
r2325 r2327 1265 1265 mr_asprintf(tmp, "Your backup will occupy approximately %s media.", number_to_text((int) (scratchLL + 1))); 1266 1266 } 1267 if ( !bkpinfo->image_devs[0] && (scratchLL < 50)) {1267 if (scratchLL < 50) { 1268 1268 log_to_screen(tmp); 1269 1269 } -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2326 r2327 479 479 if (bkpinfo->use_lzo) { 480 480 mr_asprintf(bkpinfo->zip_exe, "lzop"); 481 strcpy(bkpinfo->zip_suffix, "lzo");481 mr_asprintf(bkpinfo->zip_suffix, "lzo"); 482 482 } else if (bkpinfo->use_gzip) { 483 483 mr_asprintf(bkpinfo->zip_exe, "gzip"); 484 strcpy(bkpinfo->zip_suffix, "gz");484 mr_asprintf(bkpinfo->zip_suffix, "gz"); 485 485 } else if (bkpinfo->compression_level != 0) { 486 486 mr_asprintf(bkpinfo->zip_exe, "bzip2"); 487 strcpy(bkpinfo->zip_suffix, "bz2"); 487 mr_asprintf(bkpinfo->zip_suffix, "bz2"); 488 } else { 489 mr_asprintf(bkpinfo->zip_exe, "none"); 490 mr_asprintf(bkpinfo->zip_suffix, ""); 488 491 } 489 492 … … 798 801 mr_free(bkpinfo->boot_device); 799 802 mr_free(bkpinfo->zip_exe); 803 mr_free(bkpinfo->zip_suffix); 804 mr_free(bkpinfo->image_devs); 800 805 mr_free(bkpinfo->isodir); 801 806 mr_free(bkpinfo->prefix); … … 804 809 mr_free(bkpinfo->include_paths); 805 810 mr_free(bkpinfo->exclude_paths); 811 mr_free(bkpinfo->restore_path); 806 812 mr_free(bkpinfo->nfs_mount); 807 813 mr_free(bkpinfo->nfs_remote_dir); … … 829 835 bkpinfo->boot_device = NULL; 830 836 bkpinfo->zip_exe = NULL; 831 bkpinfo->zip_suffix [0] = '\0';832 bkpinfo->image_devs [0] = '\0';837 bkpinfo->zip_suffix = NULL; 838 bkpinfo->image_devs = NULL; 833 839 bkpinfo->compression_level = 3; 834 840 bkpinfo->use_lzo = FALSE; … … 853 859 bkpinfo->include_paths = NULL; 854 860 bkpinfo->exclude_paths = NULL; 855 bkpinfo->restore_path [0] = '\0';861 bkpinfo->restore_path = NULL; 856 862 bkpinfo->call_before_iso[0] = '\0'; 857 863 bkpinfo->call_make_iso[0] = '\0'; -
branches/2.2.10/mondo/src/common/libmondo-verify.c
r2326 r2327 55 55 assert(bkpinfo != NULL); 56 56 assert_string_is_neither_NULL_nor_zerolength(mountpoint); 57 sprintf(output, "%s/archives/%d.star.%s", mountpoint, setno, 58 bkpinfo->zip_suffix); 57 sprintf(output, "%s/archives/%d.star.%s", mountpoint, setno, bkpinfo->zip_suffix); 59 58 if (!does_file_exist(output)) { 60 sprintf(output, "%s/archives/%d.afio.%s", mountpoint, setno, 61 bkpinfo->zip_suffix); 59 sprintf(output, "%s/archives/%d.afio.%s", mountpoint, setno, bkpinfo->zip_suffix); 62 60 } 63 61 return (output); … … 216 214 char *command = NULL; 217 215 char *mds = NULL; 218 char *sz_exe ;216 char *sz_exe = NULL; 219 217 static char *bufblkA = NULL; 220 218 static char *bufblkB = NULL; … … 237 235 int retval = 0; 238 236 239 malloc_string(sz_exe);240 237 if (!bufblkA) { 241 238 if (!(bufblkA = malloc(maxbufsize))) { … … 254 251 if (bkpinfo->compression_level > 0) { 255 252 if (bkpinfo->use_lzo) { 256 strcpy(sz_exe, "lzop");253 mr_asprintf(sz_exe, "lzop"); 257 254 } else if (bkpinfo->use_gzip) { 258 strcpy(sz_exe, "gzip");255 mr_asprintf(sz_exe, "gzip"); 259 256 } else { 260 strcpy(sz_exe, "bzip2"); 261 } 262 } else { 263 sz_exe[0] = '\0'; 257 mr_asprintf(sz_exe, "bzip2"); 258 } 264 259 } 265 260 … … 289 284 // handle slices until end of CD 290 285 if (slice_num == 0) { 291 log_msg(2, "ISO=%d bigfile=%ld --START--", 292 g_current_media_number, bigfile_num); 286 log_msg(2, "ISO=%d bigfile=%ld --START--", g_current_media_number, bigfile_num); 293 287 if (! (fin = fopen(slice_fname(bigfile_num, slice_num, mountpoint, ""), "r"))) { 294 288 log_msg(2, "Cannot open bigfile's info file"); … … 299 293 paranoid_fclose(fin); 300 294 } 301 mr_asprintf(tmp, "%s/%s", bkpinfo->restore_path, biggiestruct.filename); 302 log_msg(2, "Opening biggiefile #%ld - '%s'", bigfile_num, tmp); 303 forig = fopen(tmp, "r"); 304 mr_free(tmp); 305 306 if (!forig) { 307 log_msg(2, "Failed to open bigfile. Darn."); 308 log_to_screen("%s/%s not found on live filesystem", 309 bkpinfo->restore_path, 310 biggiestruct.filename); 311 mr_asprintf(tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", bkpinfo->restore_path, biggiestruct.filename, bkpinfo->tmpdir); 312 system(tmp); 295 if (bkpinfo->restore_path) { 296 mr_asprintf(tmp, "%s/%s", bkpinfo->restore_path, biggiestruct.filename); 297 log_msg(2, "Opening biggiefile #%ld - '%s'", bigfile_num, tmp); 298 forig = fopen(tmp, "r"); 313 299 mr_free(tmp); 314 315 bigfile_num++; 316 slice_num = 0; 317 retval++; 300 301 if (!forig) { 302 log_msg(2, "Failed to open bigfile. Darn."); 303 log_to_screen("%s/%s not found on live filesystem", bkpinfo->restore_path, biggiestruct.filename); 304 mr_asprintf(tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", bkpinfo->restore_path, biggiestruct.filename, bkpinfo->tmpdir); 305 system(tmp); 306 mr_free(tmp); 307 308 bigfile_num++; 309 slice_num = 0; 310 retval++; 311 } else { 312 slice_num++; 313 } 318 314 } else { 319 slice_num++;315 log_it("Unable to open bigfile as restore_path is NULL"); 320 316 } 321 317 } else if (does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, "")) && … … 327 323 slice_num = 0; 328 324 } else { 329 log_msg(2, "ISO=%d bigfile=%ld slice=%ld", 330 g_current_media_number, bigfile_num, slice_num); 331 if (!does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, ""))) { 325 log_msg(2, "ISO=%d bigfile=%ld slice=%ld", g_current_media_number, bigfile_num, slice_num); 326 if ((!does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, ""))) && (sz_exe != NULL)) { 332 327 mr_asprintf(command, "%s -dc %s 2>> %s", sz_exe, slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix), MONDO_LOGFILE); 333 328 } else { … … 376 371 } 377 372 mr_free(mountpoint); 373 mr_free(sz_exe); 374 378 375 last_bigfile_num = bigfile_num; 379 376 last_slice_num = slice_num - 1; … … 388 385 paranoid_free(bufblkB); 389 386 } 390 paranoid_free(sz_exe);391 387 return (0); 392 388 } … … 435 431 mr_free(bkpinfo->zip_exe); 436 432 mr_asprintf(bkpinfo->zip_exe, "lzop"); 437 strcpy(bkpinfo->zip_suffix, "lzo"); 433 mr_free(bkpinfo->zip_suffix); 434 mr_asprintf(bkpinfo->zip_suffix, "lzo"); 438 435 bkpinfo->use_lzo = TRUE; 439 436 bkpinfo->use_gzip = FALSE; … … 443 440 mr_free(bkpinfo->zip_exe); 444 441 mr_asprintf(bkpinfo->zip_exe, "gzip"); 445 strcpy(bkpinfo->zip_suffix, "gz"); 442 mr_free(bkpinfo->zip_suffix); 443 mr_asprintf(bkpinfo->zip_suffix, "gz"); 446 444 bkpinfo->use_lzo = FALSE; 447 445 bkpinfo->use_gzip = TRUE; … … 451 449 mr_free(bkpinfo->zip_exe); 452 450 mr_asprintf(bkpinfo->zip_exe, "bzip2"); 453 strcpy(bkpinfo->zip_suffix, "bz2"); 451 mr_free(bkpinfo->zip_suffix); 452 mr_asprintf(bkpinfo->zip_suffix, "bz2"); 454 453 bkpinfo->use_lzo = FALSE; 455 454 bkpinfo->use_gzip = FALSE; 455 } 456 if (bkpinfo->zip_exe == NULL) { 457 mr_asprintf(bkpinfo->zip_exe, "none"); 458 } 459 if (bkpinfo->zip_suffix == NULL) { 460 mr_asprintf(bkpinfo->zip_suffix, ""); 456 461 } 457 462 unlink(outlog); … … 686 691 * Verify all afioballs from the opened tape/CD stream. 687 692 * @param bkpinfo The backup information structure. Fields used: 688 * - @c bkpinfo->restore_path689 693 * - @c bkpinfo->tmpdir 690 694 * … … 880 884 mr_free(comment); 881 885 882 mr_asprintf(logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname); 883 res = verify_a_biggiefile_from_stream(logical_fname, size); 884 mr_free(logical_fname); 885 886 retval += res; 886 if (bkpinfo->restore_path) { 887 mr_asprintf(logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname); 888 res = verify_a_biggiefile_from_stream(logical_fname, size); 889 mr_free(logical_fname); 890 retval += res; 891 } else { 892 log_it("Unable to verify bigfile as restore_path is NULL"); 893 } 894 887 895 current_biggiefile_number++; 888 896 g_current_progress++; -
branches/2.2.10/mondo/src/common/mondostructures.h
r2326 r2327 382 382 * bz2, gzip uses gz, etc. Do not include the dot. 383 383 */ 384 char zip_suffix[MAX_STR_LEN / 4];384 char *zip_suffix; 385 385 386 386 /** … … 397 397 * This is a useful feature, but use at your own risk. 398 398 */ 399 char image_devs[MAX_STR_LEN / 4];399 char *image_devs; 400 400 401 401 /** … … 519 519 * without overwriting the old ones. Ignored during a backup. 520 520 */ 521 char restore_path[MAX_STR_LEN];521 char *restore_path; 522 522 523 523 /** -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c
r2325 r2327 667 667 chdir(bkpinfo->restore_path); 668 668 669 mr_asprintf( &command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);669 mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path); 670 670 run_program_and_log_output(command, FALSE); 671 671 mr_free(command); -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c
r2326 r2327 895 895 mr_free(value); 896 896 897 bkpinfo->zip_suffix[0] = '\0';898 897 value = read_cfg_var(cfg_file, "use-lzo"); 899 898 if (value && strstr(value, "yes")) { … … 902 901 mr_free(bkpinfo->zip_exe); 903 902 mr_asprintf(bkpinfo->zip_exe, "lzop"); 904 strcpy(bkpinfo->zip_suffix, "lzo"); 903 mr_free(bkpinfo->zip_suffix); 904 mr_asprintf(bkpinfo->zip_suffix, "lzo"); 905 905 } 906 906 mr_free(value); … … 912 912 mr_free(bkpinfo->zip_exe); 913 913 mr_asprintf(bkpinfo->zip_exe, "gzip"); 914 strcpy(bkpinfo->zip_suffix, "gz"); 914 mr_free(bkpinfo->zip_suffix); 915 mr_asprintf(bkpinfo->zip_suffix, "gz"); 915 916 } 916 917 mr_free(value); … … 922 923 mr_free(bkpinfo->zip_exe); 923 924 mr_asprintf(bkpinfo->zip_exe, "bzip2"); 924 strcpy(bkpinfo->zip_suffix, "bz2"); 925 mr_free(bkpinfo->zip_suffix); 926 mr_asprintf(bkpinfo->zip_suffix, "bz2"); 925 927 } 926 928 mr_free(value); 929 930 if (bkpinfo->zip_exe == NULL) { 931 mr_asprintf(bkpinfo->zip_exe, "none"); 932 } 933 if (bkpinfo->zip_suffix == NULL) { 934 mr_asprintf(bkpinfo->zip_suffix, ""); 935 } 927 936 928 937 value = read_cfg_var(cfg_file, "differential"); -
branches/2.2.10/mondo/src/mondorestore/mondorestore.c
r2326 r2327 360 360 char *tmp1 = NULL; 361 361 362 /* Clean up blkid cache file if they exist */ 363 mr_asprintf(tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path); 364 (void)unlink(tmp1); 365 paranoid_free(tmp1); 366 mr_asprintf(tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path); 367 (void)unlink(tmp1); 368 paranoid_free(tmp1); 362 if (bkpinfo->restore_path) { 363 /* Clean up blkid cache file if they exist */ 364 mr_asprintf(tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path); 365 (void)unlink(tmp1); 366 paranoid_free(tmp1); 367 mr_asprintf(tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path); 368 (void)unlink(tmp1); 369 paranoid_free(tmp1); 370 } 369 371 } 370 372 … … 375 377 char *editor = NULL; 376 378 377 /* Clean up multiconf cache file if they exist */ 378 mr_asprintf(tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path); 379 (void)unlink(tmp1); 380 paranoid_free(tmp1); 379 if (bkpinfo->restore_path) { 380 /* Clean up multiconf cache file if they exist */ 381 mr_asprintf(tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path); 382 (void)unlink(tmp1); 383 paranoid_free(tmp1); 384 } 381 385 382 386 /* Edit multipath.conf if needed to adapt wwid */ … … 425 429 * @return 0 for success, or the number of errors encountered. 426 430 */ 427 int 428 interactive_mode(struct mountlist_itself *mountlist, 429 struct raidlist_itself *raidlist) 431 int interactive_mode(struct mountlist_itself *mountlist, struct raidlist_itself *raidlist) 430 432 { 431 433 int retval = 0; … … 442 444 char *tmp1 = NULL; 443 445 char *fstab_fname; 444 char *old_restpath ;446 char *old_restpath = NULL; 445 447 446 448 struct s_node *filelist; … … 452 454 malloc_string(tmp); 453 455 malloc_string(fstab_fname); 454 malloc_string(old_restpath);455 456 assert(bkpinfo != NULL); 456 457 assert(mountlist != NULL); … … 460 461 461 462 if (g_text_mode) { 462 if (!ask_me_yes_or_no 463 ("Interactive Mode + textonly = experimental! Proceed anyway?")) 464 { 463 if (!ask_me_yes_or_no("Interactive Mode + textonly = experimental! Proceed anyway?")) { 465 464 fatal_error("Wise move."); 466 465 } … … 473 472 474 473 #ifdef __FreeBSD__ 475 if (strstr 476 (call_program_and_get_last_line_of_output("cat /tmp/cmdline"), 477 "noresize")) 474 if (strstr(call_program_and_get_last_line_of_output("cat /tmp/cmdline"), "noresize")) 478 475 #else 479 if (strstr 480 (call_program_and_get_last_line_of_output("cat /proc/cmdline"), 481 "noresize")) 476 if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "noresize")) 482 477 #endif 483 478 { … … 581 576 } 582 577 /* restore */ 583 if ((restore_all = 584 ask_me_yes_or_no("Do you want me to restore all of your data?"))) 585 { 578 if ((restore_all = ask_me_yes_or_no("Do you want me to restore all of your data?"))) { 586 579 log_msg(1, "Restoring all data"); 587 580 retval += restore_everything(NULL); 588 } else 589 if ((restore_all = 590 ask_me_yes_or_no 591 ("Do you want me to restore _some_ of your data?"))) { 592 strcpy(old_restpath, bkpinfo->restore_path); 581 } else if ((restore_all = ask_me_yes_or_no("Do you want me to restore _some_ of your data?"))) { 582 mr_asprintf(old_restpath, "%s", bkpinfo->restore_path); 593 583 for (done = FALSE; !done;) { 594 584 unlink("/tmp/filelist.full"); … … 610 600 tmp[0] = '\0'; // so we restore to [blank]/file/name :) 611 601 } 612 strcpy(bkpinfo->restore_path, tmp); 602 mr_free(bkpinfo->restore_path); 603 mr_asprintf(bkpinfo->restore_path, "%s", tmp); 613 604 log_msg(1, "Restoring subset"); 614 605 retval += restore_everything(filelist); 615 free_filelist(filelist);616 606 } else { 617 strcpy(bkpinfo->restore_path, old_restpath);618 free_filelist(filelist);607 mr_free(bkpinfo->restore_path); 608 mr_asprintf(bkpinfo->restore_path, "%s", old_restpath); 619 609 } 610 free_filelist(filelist); 620 611 mr_free(p); 621 612 622 if (!ask_me_yes_or_no 623 ("Restore another subset of your backup?")) { 613 if (!ask_me_yes_or_no("Restore another subset of your backup?")) { 624 614 done = TRUE; 625 615 } … … 628 618 } 629 619 } 630 strcpy(old_restpath, bkpinfo->restore_path); 631 } else { 632 mvaddstr_and_log_it(g_currentY++, 633 0, 634 "User opted not to restore any data. "); 620 mr_free(old_restpath); 621 } else { 622 mvaddstr_and_log_it(g_currentY++, 0, "User opted not to restore any data. "); 635 623 } 636 624 if (retval) { 637 mvaddstr_and_log_it(g_currentY++, 638 0, 639 "Errors occurred during the restore phase. "); 625 mvaddstr_and_log_it(g_currentY++, 0, "Errors occurred during the restore phase. "); 640 626 } 641 627 … … 685 671 paranoid_free(tmp); 686 672 paranoid_free(fstab_fname); 687 paranoid_free(old_restpath);688 673 log_it("Leaving interactive_mode()"); 689 674 return (retval); … … 942 927 int retval = 0; 943 928 944 /** malloc **/ 945 char *old_restpath; 929 char *old_restpath = NULL; 946 930 char *p = NULL; 947 931 948 932 struct mountlist_itself *mountlist = NULL; 949 // static950 933 struct raidlist_itself *raidlist = NULL; 951 934 struct s_node *filelist = NULL; … … 953 936 log_msg(1, "restore_to_live_filesystem() - starting"); 954 937 assert(bkpinfo != NULL); 955 malloc_string(old_restpath);956 938 mountlist = malloc(sizeof(struct mountlist_itself)); 957 939 raidlist = malloc(sizeof(struct raidlist_itself)); … … 960 942 } 961 943 962 strcpy(bkpinfo->restore_path, "/"); 944 mr_free(bkpinfo->restore_path); 945 mr_asprintf(bkpinfo->restore_path, "/"); 963 946 if (!g_restoring_live_from_cd && !g_restoring_live_from_nfs) { 964 947 popup_and_OK … … 990 973 if (!g_restoring_live_from_nfs && (filelist = process_filelist_and_biggielist())) { 991 974 save_filelist(filelist, "/tmp/selected-files.txt"); 992 strcpy(old_restpath, bkpinfo->restore_path);975 mr_asprintf(old_restpath, "%s", bkpinfo->restore_path); 993 976 p = popup_and_get_string("Restore path", "Restore files to where? )", bkpinfo->restore_path); 994 977 if (p != NULL) { 995 strcpy(bkpinfo->restore_path, p);996 mr_free(p);978 mr_free(bkpinfo->restore_path); 979 bkpinfo->restore_path = p; 997 980 998 981 log_it("Restoring everything"); 999 982 retval += restore_everything(filelist); 1000 free_filelist(filelist); 1001 strcpy(bkpinfo->restore_path, old_restpath); 1002 } else { 1003 free_filelist(filelist); 1004 } 1005 strcpy(bkpinfo->restore_path, old_restpath); 983 } 984 free_filelist(filelist); 985 mr_free(bkpinfo->restore_path); 986 bkpinfo->restore_path = old_restpath; 1006 987 } else { 1007 988 if (filelist != NULL) { … … 1022 1003 eject_device(bkpinfo->media_device); 1023 1004 } 1024 paranoid_free(old_restpath);1025 1005 free(mountlist); 1026 1006 free(raidlist); … … 2427 2407 * @return 0 for success, or the number of filesets that failed. 2428 2408 */ 2429 int 2430 restore_all_tarballs_from_stream(struct s_node *filelist) 2409 int restore_all_tarballs_from_stream(struct s_node *filelist) 2431 2410 { 2432 2411 int retval = 0; … … 2904 2883 g_restoring_live_from_nfs = TRUE; 2905 2884 } 2885 /* Adding an initialisation in order to avoid to hndle NULL pointer later */ 2886 mr_free(bkpinfo->restore_path); 2887 mr_asprintf(bkpinfo->restore_path, "%s", "/tmp"); 2888 2906 2889 log_msg(2, "Calling restore_to_live_filesystem()"); 2907 2890 retval = restore_to_live_filesystem(); … … 2921 2904 2922 2905 log_it("About to call load_mountlist and load_raidtab"); 2923 strcpy(bkpinfo->restore_path, MNT_RESTORING); 2906 mr_free(bkpinfo->restore_path); 2907 mr_asprintf(bkpinfo->restore_path, "%s", MNT_RESTORING); 2924 2908 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 2925 2909 retval = load_mountlist(mountlist, g_mountlist_fname);
Note:
See TracChangeset
for help on using the changeset viewer.