Changeset 783 in MondoRescue for trunk/mondo/mondo/common/libmondo-tools.c
- Timestamp:
- Aug 31, 2006, 5:09:20 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-tools.c
r689 r783 74 74 75 75 extern t_bkptype g_backup_media_type; 76 extern char *g_backup_media_string; 76 77 77 78 extern bool am_I_in_disaster_recovery_mode(void); … … 281 282 { 282 283 assert(raidrec != NULL); 283 raidrec->raid_device [0] = '\0';284 raidrec->raid_device = NULL; 284 285 raidrec->raid_level = -9; 285 286 raidrec->persistent_superblock = 1; … … 356 357 char *tmp = NULL; 357 358 char *tmp1 = NULL; 358 char call_before_iso_user[MAX_STR_LEN] = "\0";359 char *call_before_iso_user = NULL; 359 360 int rdsiz_MB; 360 361 char *iso_path = NULL; … … 415 416 if (avm / 1024 > rdsiz_MB * 3) { 416 417 if (run_program_and_log_output(command, 5)) { 417 g_tmpfs_mountpt[0] = '\0';418 paranoid_free(g_tmpfs_mountpt); 418 419 log_it("Failed to mount tmpfs"); 419 420 } else { … … 421 422 } 422 423 } else { 423 g_tmpfs_mountpt[0] = '\0';424 paranoid_free(g_tmpfs_mountpt); 424 425 log_it("It doesn't seem you have enough swap to use tmpfs. Fine."); 425 426 } … … 427 428 428 429 if (bkpinfo->use_lzo) { 429 strcpy(bkpinfo->zip_exe, "lzop");430 strcpy(bkpinfo->zip_suffix, "lzo");430 paranoid_alloc(bkpinfo->zip_exe, "lzop"); 431 paranoid_alloc(bkpinfo->zip_suffix, "lzo"); 431 432 } else if (bkpinfo->compression_level != 0) { 432 strcpy(bkpinfo->zip_exe, "bzip2");433 strcpy(bkpinfo->zip_suffix, "bz2");433 paranoid_alloc(bkpinfo->zip_exe, "bzip2"); 434 paranoid_alloc(bkpinfo->zip_suffix, "bz2"); 434 435 } else { 435 bkpinfo->zip_exe[0] = bkpinfo->zip_suffix[0] = '\0'; 436 bkpinfo->zip_exe = NULL; 437 bkpinfo->zip_suffix = NULL; 436 438 } 437 439 … … 470 472 // -m isn't supported by growisofs, BTW... 471 473 } else { 472 sprintf(bkpinfo->call_make_iso,474 asprintf(&bkpinfo->call_make_iso, 473 475 "%s %s -Z %s . 2>> _ERR_", 474 476 mondo_mkisofs_sz, "", bkpinfo->media_device); … … 518 520 519 521 if (bkpinfo->nonbootable_backup) { 520 asprintf(&mondo_mkisofs_sz, "%s -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL_Version -V _CD#_", mrconf->mondo_iso_creation_cmd);522 asprintf(&mondo_mkisofs_sz, "%s -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL_Version -V _CD#_", bkpinfo->mr_conf->mondo_iso_creation_cmd); 521 523 } else if 522 524 #ifdef __FreeBSD__ … … 539 541 } 540 542 if (bkpinfo->manual_cd_tray) { 541 if (bkpinfo->call_before_iso [0] == '\0') {542 sprintf(bkpinfo->call_before_iso,543 if (bkpinfo->call_before_iso == NULL) { 544 asprintf(&bkpinfo->call_before_iso, 543 545 "%s -o %s/temporary.iso . 2>> _ERR_", 544 546 mondo_mkisofs_sz, bkpinfo->tmpdir); 545 546 strncpy(call_before_iso_user, bkpinfo->call_before_iso, MAX_STR_LEN);547 sprintf (bkpinfo->call_before_iso,547 } else { 548 asprintf(&call_before_iso_user, bkpinfo->call_before_iso); 549 asprintf(&bkpinfo->call_before_iso, 548 550 "( %s -o %s/temporary.iso . 2>> _ERR_ ; %s )", 549 551 mondo_mkisofs_sz, bkpinfo->tmpdir, call_before_iso_user); 552 paranoid_free(call_before_iso_user); 550 553 } 551 554 log_it("bkpinfo->call_before_iso = %s", bkpinfo->call_before_iso); 552 sprintf(bkpinfo->call_make_iso,555 asprintf(&bkpinfo->call_make_iso, 553 556 "%s %s -v %s fs=4m dev=%s speed=%d %s/temporary.iso", 554 557 cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", … … 556 559 bkpinfo->cdrw_speed, bkpinfo->tmpdir); 557 560 } else { 558 sprintf(bkpinfo->call_make_iso,561 asprintf(&bkpinfo->call_make_iso, 559 562 "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s speed=%d -", 560 563 mondo_mkisofs_sz, cdr_exe, … … 641 644 h_addr)), 642 645 strchr(bkpinfo->nfs_mount, ':')); 643 strcpy(bkpinfo->nfs_mount, ip_address);646 paranoid_alloc(bkpinfo->nfs_mount, ip_address); 644 647 paranoid_free(ip_address); 645 648 } … … 663 666 retval++; 664 667 } 665 if (bkpinfo->include_paths [0] == '\0') {668 if (bkpinfo->include_paths == NULL) { 666 669 // fatal_error ("Why no backup path?"); 667 strcpy(bkpinfo->include_paths, "/");670 asprintf(&bkpinfo->include_paths, "/"); 668 671 } 669 672 chmod(bkpinfo->scratchdir, 0700); 670 673 chmod(bkpinfo->tmpdir, 0700); 671 674 g_backup_media_type = bkpinfo->backup_media_type; 675 paranoid_alloc(g_backup_media_string,bkpinfo->backup_media_string); 672 676 return (retval); 673 677 } … … 712 716 g_current_media_number = 1; 713 717 bkpinfo->postnuke_tarball = NULL; 714 bkpinfo->nfs_mount = NULL;718 paranoid_free(bkpinfo->nfs_mount); 715 719 return (res); 716 720 } … … 748 752 paranoid_free(bkpinfo->restore_path); 749 753 bkpinfo->use_lzo = FALSE; 750 paranoid_free(bkpinfo->do_not_compress_these);751 754 bkpinfo->verify_data = FALSE; 752 755 bkpinfo->backup_data = FALSE; … … 767 770 bkpinfo->optimal_set_size = 0; 768 771 bkpinfo->backup_media_type = none; 772 paranoid_free(bkpinfo->backup_media_string); 769 773 paranoid_alloc(bkpinfo->include_paths, "/"); 770 774 paranoid_free(bkpinfo->exclude_paths); … … 1043 1047 value = NULL; 1044 1048 return (1); 1045 } else if (strstr(value, "/dev/") && strstr(value, "t0") 1049 /* } BERLIOS: Useless: 1050 else if (strstr(value, "/dev/") && strstr(value, "t0") 1046 1051 && !strcmp(label, "media-dev")) { 1047 1052 log_msg(2, "FYI, I shan't read new value for %s - already got %s", 1048 1053 label, value); 1049 1054 return (0); 1050 } else {1055 */ } else { 1051 1056 asprintf(&command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", 1052 1057 label, config_file); … … 1102 1107 1103 1108 log_msg(1, "Started sub"); 1104 log_msg(4, "About to set g_boot_mountpt to \"\""); 1105 asprintf(&g_boot_mountpt, ""); 1106 log_msg(4, "Done. Great. Seeting command to something"); 1109 log_msg(4, "Setting command to something"); 1107 1110 asprintf(&command, 1108 1111 "grep -v \":\" /etc/fstab | grep -vx \"#.*\" | grep -w \"/boot\" | tr -s ' ' '\t' | cut -f1 | head -n1"); … … 1136 1139 asprintf(&tmp1, "mount %s", g_boot_mountpt); 1137 1140 if (run_program_and_log_output(tmp1, 5)) { 1141 /* BERLIOS: Useless ??? 1138 1142 paranoid_free(g_boot_mountpt); 1139 1143 asprintf(&g_boot_mountpt, " "); 1144 */ 1140 1145 log_msg(1, "Plan B"); 1141 1146 if (!run_program_and_log_output("mount /boot", 5)) { … … 1166 1171 1167 1172 log_msg(3, "starting"); 1168 if (g_boot_mountpt [0]) {1173 if (g_boot_mountpt != NULL) { 1169 1174 asprintf(&tmp, "umount %s", g_boot_mountpt); 1170 1175 if (run_program_and_log_output(tmp, 5)) {
Note:
See TracChangeset
for help on using the changeset viewer.