Changeset 2334 in MondoRescue for branches/2.2.10/mondo/src/common
- Timestamp:
- Aug 18, 2009, 5:28:18 PM (15 years ago)
- Location:
- branches/2.2.10/mondo/src/common
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive-EXT.h
r1885 r2334 10 10 extern int do_that_initial_phase(); 11 11 extern int do_that_final_phase(); 12 extern int figure_out_kernel_path_interactively_if_necessary(char *kernel);12 extern char *figure_out_kernel_path_interactively_if_necessary(void); 13 13 extern int make_those_slices_phase(); 14 14 extern int make_those_afios_phase(); -
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2331 r2334 441 441 442 442 copy_mondo_and_mindi_stuff_to_scratchdir(); // payload, too, if it exists 443 mr_free(bkpinfo->kernel_path); 443 444 #if __FreeBSD__ == 5 444 445 mr_asprintf(bkpinfo->kernel_path, "/boot/kernel/kernel"); … … 446 447 mr_asprintf(bkpinfo->kernel_path, "/kernel"); 447 448 #elif linux 448 if ( figure_out_kernel_path_interactively_if_necessary(bkpinfo->kernel_path)) {449 if ((bkpinfo->kernel_path = figure_out_kernel_path_interactively_if_necessary()) == NULL) { 449 450 fatal_error("Kernel not found. Please specify manually with the '-k' switch."); 450 451 } … … 854 855 use_gzip_sz); // parameter #20 (STRING) 855 856 857 mr_free(tmp2); 856 858 mr_free(devs_to_exclude); 857 859 mr_free(last_filelist_number); -
branches/2.2.10/mondo/src/common/libmondo-archive.h
r1885 r2334 11 11 int do_that_initial_phase(); 12 12 int do_that_final_phase(); 13 int figure_out_kernel_path_interactively_if_necessary(char *kernel);13 char *figure_out_kernel_path_interactively_if_necessary(void); 14 14 bool get_bit_N_of_array(char *array, int N); 15 15 int make_those_slices_phase(); -
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2332 r2334 886 886 if ((flag_set['t'] && !flag_set['d']) && (! bkpinfo->restore_data)) { 887 887 log_it("Hmm! No tape drive specified. Let's see what we can do."); 888 if ((tmp1 = find_tape_device_and_size(NULL)) == NULL) {888 if ((tmp1 = mr_find_tape_device()) == NULL) { 889 889 fatal_error("Tape device not specified. I couldn't find it either."); 890 890 } … … 1191 1191 1192 1192 if (flag_set['x']) { 1193 mr_asprintf(bkpinfo->image_devs, flag_val['x']);1193 mr_asprintf(bkpinfo->image_devs, "%s", flag_val['x']); 1194 1194 if ((run_program_and_log_output("which ntfsclone", 2)) && (! bkpinfo->restore_data)) { 1195 1195 fatal_error("Please install ntfsprogs package/tarball."); … … 1202 1202 1203 1203 if ((flag_set['k']) && (! bkpinfo->restore_data)) { 1204 mr_free(bkpinfo->kernel_path); 1204 1205 mr_asprintf(bkpinfo->kernel_path, "%s", flag_val['k']); 1205 1206 if (!strcmp(bkpinfo->kernel_path, "failsafe")) { … … 1552 1553 case SIGKILL: 1553 1554 mr_asprintf(tmp, "SIGKILL"); 1554 mr_asprintf(tmp2, 1555 "I seriously have no clue how this signal even got to me. Something's wrong with your system."); 1555 mr_asprintf(tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system."); 1556 1556 break; 1557 1557 case SIGTERM: … … 1565 1565 case SIGSEGV: 1566 1566 mr_asprintf(tmp, "SIGSEGV"); 1567 mr_asprintf(tmp2, 1568 "Internal programming error. Please send a backtrace as well as your log."); 1567 mr_asprintf(tmp2, "Internal programming error. Please send a backtrace as well as your log."); 1569 1568 break; 1570 1569 case SIGPIPE: -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2332 r2334 131 131 mr_free(tmp); 132 132 133 if (is_this_a_ramdisk) {134 if (!does_file_exist("/THIS-IS-A-RAMDISK")) {135 log_to_screen("Using /dev/root is stupid of you but I'll forgive you.");136 is_this_a_ramdisk = FALSE;137 }138 }139 if (does_file_exist("/THIS-IS-A-RAMDISK")) {140 is_this_a_ramdisk = TRUE;141 }142 133 log_msg(1, "Is this a ramdisk? result = %s", (is_this_a_ramdisk) ? "TRUE" : "FALSE"); 143 134 return (is_this_a_ramdisk); … … 515 506 516 507 if (g_cdrw_drive_is_here[0]) { 517 mr_asprintf(cdrw_device, g_cdrw_drive_is_here);508 mr_asprintf(cdrw_device, "%s", g_cdrw_drive_is_here); 518 509 log_msg(3, "Been there, done that. Returning %s", cdrw_device); 519 510 return(cdrw_device); … … 840 831 841 832 if (g_dvd_drive_is_here[0]) { 842 mr_asprintf(output, g_dvd_drive_is_here);833 mr_asprintf(output, "%s", g_dvd_drive_is_here); 843 834 log_msg(3, "Been there, done that. Returning %s", output); 844 835 return (output); … … 1599 1590 1600 1591 mr_free(bkpinfo->media_device); 1601 if ((!bkpinfo->restore_mode) && ((bkpinfo->media_device = find_tape_device_and_size(NULL)) == NULL)) {1592 if ((!bkpinfo->restore_mode) && ((bkpinfo->media_device = mr_find_tape_device()) == NULL)) { 1602 1593 log_msg(3, "Ok, using vanilla scsi tape."); 1603 1594 mr_asprintf(bkpinfo->media_device, "%s", VANILLA_SCSI_TAPE); … … 1641 1632 mr_free(tmp); 1642 1633 1643 bkpinfo->use_obdr = ask_me_yes_or_no 1644 ("Do you want to activate OBDR support for your tapes ?"); 1634 bkpinfo->use_obdr = ask_me_yes_or_no("Do you want to activate OBDR support for your tapes ?"); 1645 1635 bkpinfo->media_size[0] = 0; 1646 1636 log_msg(4, "media_size[0] = %ld", bkpinfo->media_size[0]); -
branches/2.2.10/mondo/src/common/libmondo-files-EXT.h
r2325 r2334 11 11 extern bool does_file_exist(char *filename); 12 12 extern void exclude_nonexistent_files(char *inout); 13 extern int figure_out_kernel_path_interactively_if_necessary(char *kernel);13 extern char *figure_out_kernel_path_interactively_if_necessary(void); 14 14 extern char *find_home_of_exe(char *fname); 15 15 extern int get_trackno_from_logfile(char *logfile); -
branches/2.2.10/mondo/src/common/libmondo-files.c
r2332 r2334 269 269 * @return 0 for success, 1 for failure. 270 270 */ 271 int figure_out_kernel_path_interactively_if_necessary(char *kernel) 272 { 271 char *figure_out_kernel_path_interactively_if_necessary(void) { 272 273 273 char *tmp = NULL; 274 274 char *command = NULL;; 275 276 if (kernel == NULL) { 277 278 }275 char *kernel = NULL;; 276 277 mr_asprintf(kernel, "%s", call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null")); 278 279 279 // If we didn't get anything back, check whether mindi raised a fatal error 280 280 if (!kernel[0]) { … … 285 285 mr_free(tmp); 286 286 mr_free(command); 287 mr_free(kernel); 287 288 fatal_error("Mindi gave a fatal error. Please check '/var/log/mindi.log'."); 288 289 } … … 293 294 while (!kernel[0]) { 294 295 if (!ask_me_yes_or_no("Kernel not found or invalid. Choose another?")) { 295 return ( 1);296 return (NULL); 296 297 } 297 298 tmp = popup_and_get_string("Kernel path", "What is the full path and filename of your kernel, please?", kernel); … … 304 305 log_it("User says kernel is at %s", kernel); 305 306 } 306 return ( 0);307 return (kernel); 307 308 } 308 309 … … 1103 1104 } 1104 1105 *(p++) = '\0'; 1105 mr_asprintf(nfs_server_ipaddr, tmp);1106 mr_asprintf(nfs_mount, p);1106 mr_asprintf(nfs_server_ipaddr, "%s", tmp); 1107 mr_asprintf(nfs_mount, "%s", p); 1107 1108 mr_free(tmp); 1108 1109 … … 1151 1152 mr_free(nfs_dev); 1152 1153 1153 mr_asprintf(nfs_dev, call_program_and_get_last_line_of_output(command));1154 mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command)); 1154 1155 mr_free(command); 1155 1156 -
branches/2.2.10/mondo/src/common/libmondo-files.h
r2325 r2334 14 14 bool does_file_exist(char *filename); 15 15 void exclude_nonexistent_files(char *inout); 16 int figure_out_kernel_path_interactively_if_necessary(char *kernel);16 char *figure_out_kernel_path_interactively_if_necessary(void); 17 17 char *find_home_of_exe(char *fname); 18 18 int get_trackno_from_logfile(char *logfile); -
branches/2.2.10/mondo/src/common/libmondo-raid.c
r2324 r2334 334 334 #ifdef __FreeBSD__ 335 335 int i, j; 336 char *org = NULL; 336 337 337 338 fprintf(fout, "\nvolume %s\n", raidrec->volname); 338 339 for (i = 0; i < raidrec->plexes; ++i) { 339 char org[24];340 340 switch (raidrec->plex[i].raidlevel) { 341 341 case -1: 342 strcpy(org, "concat");342 mr_asprintf(org, "concat"); 343 343 break; 344 344 case 0: 345 strcpy(org, "striped");345 mr_asprintf(org, "striped"); 346 346 break; 347 347 case 5: 348 strcpy(org, "raid5");348 mr_asprintf(org, "raid5"); 349 349 break; 350 350 } 351 351 fprintf(fout, " plex org %s", org); 352 mr_free(org); 353 352 354 if (raidrec->plex[i].raidlevel != -1) { 353 355 fprintf(fout, " %ik", raidrec->plex[i].stripesize); … … 356 358 357 359 for (j = 0; j < raidrec->plex[i].subdisks; ++j) { 358 fprintf(fout, " sd drive %s size 0\n", 359 raidrec->plex[i].sd[j].which_device); 360 fprintf(fout, " sd drive %s size 0\n", raidrec->plex[i].sd[j].which_device); 360 361 } 361 362 } … … 501 502 502 503 if (get_option_state(argc, argv, "hotspare")) { 503 strcpy(raidlist->spares.el[raidlist->spares.entries].name, 504 drivename); 505 strcpy(raidlist->spares.el[raidlist->spares.entries]. 506 device, devname); 504 strcpy(raidlist->spares.el[raidlist->spares.entries].name, drivename); 505 strcpy(raidlist->spares.el[raidlist->spares.entries]. device, devname); 507 506 raidlist->spares.el[raidlist->spares.entries].index = 508 507 raidlist->disks.entries; 509 508 raidlist->spares.entries++; 510 509 } else { 511 strcpy(raidlist->disks.el[raidlist->disks.entries].name, 512 drivename); 513 strcpy(raidlist->disks.el[raidlist->disks.entries].device, 514 devname); 510 strcpy(raidlist->disks.el[raidlist->disks.entries].name, drivename); 511 strcpy(raidlist->disks.el[raidlist->disks.entries].device, devname); 515 512 raidlist->disks.el[raidlist->disks.entries].index = 516 513 raidlist->disks.entries; -
branches/2.2.10/mondo/src/common/libmondo-stream-EXT.h
r2332 r2334 5 5 extern int closein_tape(); 6 6 extern int closeout_tape(); 7 extern char * find_tape_device_and_size(char *siz);7 extern char *mr_find_tape_device(void); 8 8 extern void insist_on_this_tape_number(int tapeno); 9 9 extern void log_tape_pos(void); -
branches/2.2.10/mondo/src/common/libmondo-stream.c
r2332 r2334 253 253 char *dev = NULL; 254 254 int res; 255 char *dev = NULL;256 255 257 256 log_to_screen("I am looking for your tape streamer. Please wait."); … … 260 259 if (tmp) { 261 260 mr_asprintf(cdr_exe, "cdrecord"); 262 263 261 } else { 264 262 mr_asprintf(cdr_exe, "dvdrecord"); … … 273 271 log_it("Either too few or too many tape streamers for me to detect..."); 274 272 mr_asprintf(dev, "%s", VANILLA_SCSI_TAPE); 275 mr_free(tmp);276 273 mr_free(tmp); 277 274 return(dev); … … 350 347 } else { 351 348 log_it("At this new point, dev is NULL and res = %d", res); 352 mr_free(tmp);353 349 } 354 350 … … 531 527 char *tmpdir = NULL; 532 528 char *old_fname = NULL; 533 char *p;534 char suffix[16];535 529 536 530 bufsize_K = (long long) (1024LL * (1 + g_tape_buffer_size_MB)); 537 if ((p = strrchr(latest_fname, '.'))) {538 strcpy(suffix, ++p);539 } else {540 suffix[0] = '\0';541 }542 531 if (strstr(latest_fname, ".afio.") || strstr(latest_fname, ".star.")) { 543 532 type = fileset; … … 1186 1175 g_tape_stream) / 1024; 1187 1176 } 1188 /* memcpy((char*)plength_of_incoming_file,(char*)tempblock+7001,sizeof(long long)); */1189 /* for(*plen=0,i=7;i>=0;i--) {*plen<<=8; *plen |= tempblock[7001+i];} */1190 1177 memcpy((char *) plen, tempblock + 7001, sizeof(long long)); 1191 1178 if (strcmp(tempblock + 6000 + *pcontrol_char, STR_HEADER)) { … … 1193 1180 } 1194 1181 strcpy(filename, tempblock + 1000); 1195 /* strcpy(cksum,tempblock+5555);*/1196 /* log_it( "%s (reading) fname=%s, filesize=%ld K",1197 marker_to_string (*pcontrol_char), filename,1198 (long) ((*plen) >> 10));1199 */1200 1182 if (*pcontrol_char == BLK_ABORTED_BACKUP) { 1201 1183 log_to_screen("I can't verify an aborted backup."); -
branches/2.2.10/mondo/src/common/libmondo-stream.h
r2332 r2334 7 7 int closein_tape(); 8 8 int closeout_tape(); 9 char * find_tape_device_and_size(char *siz);9 char *mr_find_tape_device(void); 10 10 void insist_on_this_tape_number(int tapeno); 11 11 void log_tape_pos(void); -
branches/2.2.10/mondo/src/common/libmondo-string.c
r2323 r2334 45 45 assert(partno >= 0); 46 46 47 mr_asprintf(partition, drive);47 mr_asprintf(partition, "%s", drive); 48 48 /* is this a devfs device path? */ 49 49 c = strrchr(partition, '/'); -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2332 r2334 170 170 void clean_up_KDE_desktop_if_necessary(void) 171 171 { 172 char *tmp; 173 174 malloc_string(tmp); 175 strcpy(tmp, 176 "for i in `find /root /home -type d -name Desktop -maxdepth 2`; do \ 177 file=$i/.directory; if [ -f \"$file\" ] ; then mv -f $file $file.old ; \ 178 awk '{if (index($0, \"rootimagesmindi\")) { while (length($0)>2) { getline;} ; } \ 179 else { print $0;};}' $file.old > $file ; fi ; done"); 172 char *tmp = NULL; 173 174 mr_asprintf(tmp, "for i in `find /root /home -type d -name Desktop -maxdepth 2`; do file=$i/.directory; if [ -f \"$file\" ] ; then mv -f $file $file.old ; awk '{if (index($0, \"rootimagesmindi\")) { while (length($0)>2) { getline;} ; } else { print $0;};}' $file.old > $file ; fi ; done"); 180 175 run_program_and_log_output(tmp, 5); 181 paranoid_free(tmp);176 mr_free(tmp); 182 177 } 183 178 … … 227 222 double get_kernel_version(void) 228 223 { 229 char *p, tmp[200]; 224 char *p = NULL; 225 char *tmp = NULL; 230 226 double d; 231 227 #ifdef __FreeBSD__ … … 233 229 d = 5.2; // :-) 234 230 #else 235 strcpy(tmp, call_program_and_get_last_line_of_output("uname -r"));231 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("uname -r")); 236 232 p = strchr(tmp, '.'); 237 233 if (p) { … … 244 240 } 245 241 } 246 // log_msg(1, "tmp = '%s'", tmp);247 242 d = atof(tmp); 243 mr_free(tmp); 248 244 #endif 249 245 log_msg(1, "g_kernel_version = %f", d); … … 252 248 253 249 254 255 256 257 250 /** 258 251 * Get the current time. … … 263 256 return (long) time((void *) 0); 264 257 } 265 266 267 268 269 270 258 271 259 … … 411 399 char *command = NULL; 412 400 char *mtpt; 413 char *hostname ;401 char *hostname = NULL; 414 402 char *ip_address = NULL; 415 403 int retval = 0; 416 404 char *colon; 417 char *cdr_exe ;405 char *cdr_exe = NULL; 418 406 char *tmp = NULL; 419 407 char *p = NULL; … … 431 419 432 420 malloc_string(mtpt); 433 malloc_string(hostname);434 malloc_string(cdr_exe);435 421 bkpinfo->optimal_set_size = 436 422 (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type) ? 16 : 16) * … … 496 482 tmp = find_home_of_exe("growisofs"); 497 483 if (tmp) { 498 strcpy(cdr_exe, "growisofs");484 mr_asprintf(cdr_exe, "growisofs"); 499 485 } // unlikely to be used 500 486 else { … … 560 546 tmp = find_home_of_exe("cdrecord"); 561 547 if (tmp) { 562 strcpy(cdr_exe, "cdrecord");548 mr_asprintf(cdr_exe, "cdrecord"); 563 549 } else { 564 550 mr_free(tmp); 565 551 tmp = find_home_of_exe("dvdrecord"); 566 552 if (tmp) { 567 strcpy(cdr_exe, "dvdrecord");553 mr_asprintf(cdr_exe, "dvdrecord"); 568 554 } else { 569 555 mr_free(tmp); … … 590 576 } 591 577 #endif 592 else 593 { 578 else { 594 579 mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX); 595 580 } … … 613 598 mr_asprintf(bkpinfo->call_make_iso, "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s speed=%d -", mondo_mkisofs_sz, cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", extra_cdrom_params, bkpinfo->media_device, bkpinfo->cdrw_speed); 614 599 } 600 mr_free(cdr_exe); 615 601 paranoid_free(mondo_mkisofs_sz); 616 602 paranoid_free(extra_cdrom_params); … … 654 640 mr_asprintf(iso_path, "%s", iso_tmp + strlen(iso_mnt)); 655 641 } 642 mr_free(iso_mnt); 656 643 mr_free(iso_tmp); 657 644 … … 674 661 if (bkpinfo->backup_media_type == nfs) { 675 662 if (bkpinfo->nfs_mount) { 676 strcpy(hostname, bkpinfo->nfs_mount);663 mr_asprintf(hostname, "%s", bkpinfo->nfs_mount); 677 664 } else { 678 665 log_it("nfs_mount is NULL"); 679 666 retval++; 680 strcpy(hostname, "");667 mr_asprintf(hostname, ""); 681 668 } 682 669 colon = strchr(hostname, ':'); … … 699 686 } 700 687 } 688 mr_free(hostname); 701 689 store_nfs_config(); 702 690 } … … 712 700 g_backup_media_type = bkpinfo->backup_media_type; 713 701 paranoid_free(mtpt); 714 paranoid_free(hostname);715 paranoid_free(cdr_exe);716 702 return (retval); 717 703 } … … 1254 1240 mr_asprintf(command, "mount | grep -Ew '/boot'"); 1255 1241 mr_free(tmp); 1256 mr_asprintf(tmp, call_program_and_get_last_line_of_output(command));1242 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1257 1243 mr_free(command); 1258 1244 -
branches/2.2.10/mondo/src/common/libmondo-verify.c
r2327 r2334 623 623 /*@ char ************************************************************ */ 624 624 char *test_file = NULL; 625 char *biggie_cksum ;626 char *orig_cksum ;625 char *biggie_cksum = NULL; 626 char *orig_cksum = NULL; 627 627 char *tmp = NULL; 628 628 char *slice_fnam; … … 634 634 long long slice_siz; 635 635 636 malloc_string(biggie_cksum);637 malloc_string(orig_cksum);638 636 malloc_string(slice_fnam); 639 637 assert(bkpinfo != NULL); … … 651 649 ctrl_chr != BLK_STOP_A_BIGGIE; 652 650 res = 653 read_header_block_from_stream(&slice_siz, slice_fnam, 654 &ctrl_chr)) { 651 read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr)) { 655 652 if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 656 653 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); … … 659 656 unlink(test_file); 660 657 res = 661 read_header_block_from_stream(&slice_siz, slice_fnam, 662 &ctrl_chr); 658 read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr); 663 659 if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) { 664 660 log_msg(2, "test_file = %s", test_file); … … 668 664 retval += res; 669 665 } 670 strcpy(biggie_cksum, slice_fnam);666 mr_asprintf(biggie_cksum, "%s", slice_fnam); 671 667 if (biggie_cksum[0] != '\0') { 672 strcpy(orig_cksum, calc_checksum_of_file(biggie_fname));668 mr_asprintf(orig_cksum, "%s", calc_checksum_of_file(biggie_fname)); 673 669 if (strcmp(biggie_cksum, orig_cksum)) { 674 670 log_msg(2, "orig cksum=%s; curr cksum=%s", biggie_cksum, orig_cksum); … … 680 676 } 681 677 } 678 mr_free(biggie_cksum); 682 679 mr_free(test_file); 683 paranoid_free(biggie_cksum); 684 paranoid_free(orig_cksum); 680 mr_free(orig_cksum); 685 681 paranoid_free(slice_fnam); 686 682 return (retval); -
branches/2.2.10/mondo/src/common/newt-specific.c
r2331 r2334 345 345 log_msg(0, "-------FATAL ERROR---------"); 346 346 log_msg(0, error_string); 347 newtFinished();348 347 } 349 348 … … 395 394 } 396 395 if (!g_text_mode) { 397 if (does_file_exist("/THIS-IS-A-RAMDISK")) { 398 log_msg(1, "Calling newtFinished()"); 399 newtFinished(); 400 } else { 401 log_msg(1, "Calling newtSuspend()"); 402 newtSuspend(); 403 } 396 log_msg(1, "Calling newtFinished()"); 397 newtFinished(); 404 398 } 405 399 printf("Execution run ended; result=%d\n", signal); … … 444 438 445 439 /*@ buffers ********************************************************** */ 446 char *command ;447 char *tmp ;440 char *command = NULL; 441 char *tmp = NULL; 448 442 449 443 /*@ pointers ********************************************************* */ … … 453 447 int i = 0; 454 448 455 malloc_string(command);456 malloc_string(tmp);457 449 assert_string_is_neither_NULL_nor_zerolength(filename); 458 450 assert(grep_for_me != NULL); 459 451 460 452 if (!does_file_exist(filename)) { 461 paranoid_free(command);462 paranoid_free(tmp);463 453 return; 464 454 } 465 455 if (grep_for_me[0] != '\0') { 466 sprintf(command, "grep '%s' %s | tail -n%d", 467 grep_for_me, filename, g_noof_log_lines); 468 } else { 469 sprintf(command, "tail -n%d %s", g_noof_log_lines, 470 filename); 456 mr_asprintf(command, "grep '%s' %s | tail -n%d", grep_for_me, filename, g_noof_log_lines); 457 } else { 458 mr_asprintf(command, "tail -n%d %s", g_noof_log_lines, filename); 471 459 } 472 460 fin = popen(command, "r"); … … 483 471 */ 484 472 if (!strncmp(err_log_lines[i], "root:", 5)) { 485 strcpy(tmp, err_log_lines[i] + 6);473 mr_asprintf(tmp, "%s", err_log_lines[i] + 6); 486 474 strcpy(err_log_lines[i], tmp); 475 mr_free(tmp); 487 476 } 488 477 if (feof(fin)) { … … 493 482 paranoid_pclose(fin); 494 483 } 484 mr_free(command); 495 485 refresh_log_screen(); 496 paranoid_free(command);497 paranoid_free(tmp);498 486 } 499 487 … … 584 572 585 573 /*@ buffers ********************************************************* */ 586 char *title ;587 char *tmp ;574 char *title = NULL; 575 char *tmp = NULL; 588 576 589 577 /*@ initialize ****************************************************** */ 590 578 g_isoform_old_progress = -1; 591 579 g_mysterious_dot_counter = 0; 592 malloc_string(title); 580 581 assert(ttl != NULL); 593 582 malloc_string(tmp); 594 595 assert(ttl != NULL); 596 strcpy(title, ttl); 583 mr_asprintf(title, "%s", ttl); 597 584 strcpy(g_isoform_header_str, title); 598 585 if (g_text_mode) { … … 620 607 } 621 608 update_evalcall_form(0); 609 mr_free(title); 622 610 paranoid_free(tmp); 623 paranoid_free(title);624 611 } 625 612 … … 641 628 /*@ buffers ********************************************************* */ 642 629 char *b1c; 643 char *blurb1 ;644 char *blurb2 ;645 char *blurb3 ;630 char *blurb1 = NULL; 631 char *blurb2 = NULL; 632 char *blurb3 = NULL; 646 633 647 634 /*@ initialize ****************************************************** */ 648 635 g_mysterious_dot_counter = 0; 649 636 650 malloc_string(b1c);651 637 malloc_string(blurb1); 652 638 malloc_string(blurb2); 653 639 malloc_string(blurb3); 640 malloc_string(b1c); 654 641 655 642 assert(title != NULL); … … 658 645 assert(b3 != NULL); 659 646 660 strcpy(blurb1, b1);661 strcpy(blurb2, b2);662 strcpy(blurb3, b3);647 strcpy(blurb1, b1); 648 strcpy(blurb2, b2); 649 strcpy(blurb3, b3); 663 650 strcpy(b1c, b1); 664 651 center_string(b1c, 80); … … 695 682 update_progress_form_full(blurb1, blurb2, blurb3); 696 683 paranoid_free(b1c); 697 paranoid_free(blurb1);698 paranoid_free(blurb2);699 paranoid_free(blurb3);684 mr_free(blurb1); 685 mr_free(blurb2); 686 mr_free(blurb3); 700 687 } 701 688 … … 1176 1163 1177 1164 /*@ newt ************************************************************ */ 1178 char *title_sz ;1179 char *minimsg_sz ;1165 char *title_sz = NULL; 1166 char *minimsg_sz = NULL; 1180 1167 static t_bkptype possible_bkptypes[] = 1181 1168 { none, cdr, cdrw, dvd, tape, cdstream, udev, nfs, iso }; … … 1198 1185 newtComponent myForm; 1199 1186 1200 title_sz = malloc(MAX_NEWT_COMMENT_LEN);1201 minimsg_sz = malloc(MAX_NEWT_COMMENT_LEN);1202 1187 outstr = malloc(MAX_NEWT_COMMENT_LEN); 1203 1188 if (g_text_mode) { … … 1217 1202 } 1218 1203 } 1219 paranoid_free(title_sz);1220 paranoid_free(minimsg_sz);1221 1204 paranoid_free(outstr); 1222 1205 return (backup_type); … … 1224 1207 newtDrawRootText(18, 0, WELCOME_STRING); 1225 1208 if (restoring) { 1226 strcpy(title_sz, 1227 "Please choose the backup media from which you want to read data."); 1228 strcpy(minimsg_sz, "Read from:"); 1229 } else { 1230 strcpy(title_sz, 1231 "Please choose the backup media to which you want to archive data."); 1232 strcpy(minimsg_sz, "Backup to:"); 1209 mr_asprintf(title_sz, "Please choose the backup media from which you want to read data."); 1210 mr_asprintf(minimsg_sz, "Read from:"); 1211 } else { 1212 mr_asprintf(title_sz, "Please choose the backup media to which you want to archive data."); 1213 mr_asprintf(minimsg_sz, "Backup to:"); 1233 1214 } 1234 1215 newtPushHelpLine(title_sz); … … 1266 1247 } 1267 1248 newtPopHelpLine(); 1268 paranoid_free(title_sz);1269 paranoid_free(minimsg_sz);1249 mr_free(title_sz); 1250 mr_free(minimsg_sz); 1270 1251 paranoid_free(outstr); 1271 1252 return (output);
Note:
See TracChangeset
for help on using the changeset viewer.