- Timestamp:
- Jul 17, 2006, 7:43:58 PM (19 years ago)
- Location:
- trunk/mondo/mondo
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-archive.c
r688 r689 433 433 if (bkpinfo->backup_media_type == dvd) { 434 434 #ifdef DVDRWFORMAT 435 if (!find_home_of_exe("dvd+rw-format")) { 435 tmp = find_home_of_exe("dvd+rw-format"); 436 if (!tmp) { 436 437 fatal_error 437 438 ("Cannot find dvd+rw-format. Please install it or fix your PATH."); 438 439 } 440 paranoid_free(tmp); 439 441 #endif 440 if (!find_home_of_exe("growisofs")) { 442 tmp = find_home_of_exe("growisofs"); 443 if (!tmp) { 441 444 fatal_error 442 445 ("Cannot find growisofs. Please install it or fix your PATH."); 443 446 } 447 paranoid_free(tmp); 444 448 } 445 449 … … 3056 3060 "Not calculating checksum for %s: it would take too long", 3057 3061 biggie_filename); 3058 if ( !find_home_of_exe("ntfsresize")) { 3062 tmp = find_home_of_exe("ntfsresize"); 3063 if ( !tmp) { 3059 3064 fatal_error("ntfsresize not found"); 3060 3065 } 3061 sprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename); 3066 paranoid_free(tmp); 3067 3068 asprintf(&command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename); 3062 3069 log_it("command = %s", command); 3063 3070 tmp = call_program_and_get_last_line_of_output(command); 3071 paranoid_free(command); 3072 3064 3073 log_it("res of it = %s", tmp); 3065 3074 totallength = (off_t)atoll(tmp); -
trunk/mondo/mondo/common/libmondo-devices.c
r688 r689 495 495 char *find_cdrw_device(void) 496 496 { 497 /*@ buffers ************************ */498 char * comment;499 char *tmp ;500 char *cdr_exe ;501 char *command ;502 char *cdrw_device ;497 char *comment = NULL; 498 char *tmp = NULL; 499 char *tmp1 = NULL; 500 char *cdr_exe = NULL; 501 char *command = NULL; 502 char *cdrw_device = NULL; 503 503 504 504 if (g_cdrw_drive_is_here != NULL) { … … 513 513 } 514 514 run_program_and_log_output("insmod ide-scsi", -1); 515 if (find_home_of_exe("cdrecord")) { 515 tmp = find_home_of_exe("cdrecord"); 516 if (tmp) { 516 517 asprintf(&cdr_exe, "cdrecord"); 517 518 } else { 518 519 asprintf(&cdr_exe, "dvdrecord"); 519 520 } 520 if (find_home_of_exe(cdr_exe)) { 521 paranoid_free(tmp); 522 523 tmp1 = find_home_of_exe(cdr_exe); 524 if (tmp1) { 521 525 asprintf(&command, 522 526 "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", … … 527 531 asprintf(&tmp, " "); 528 532 } 533 paranoid_free(tmp1); 529 534 paranoid_free(cdr_exe); 530 535 … … 594 599 } 595 600 596 if (find_home_of_exe("cdrecord")) { 601 tmp = find_home_of_exe("cdrecord"); 602 if (tmp) { 597 603 asprintf(&cdr_exe, "cdrecord"); 598 604 } else { 599 605 asprintf(&cdr_exe, "dvdrecord"); 600 606 } 601 if (!find_home_of_exe(cdr_exe)) { 607 paranoid_free(tmp); 608 609 tmp = find_home_of_exe(cdr_exe); 610 if (!tmp) { 602 611 asprintf(&output, "/dev/cdrom"); 603 612 log_msg(4, "Can't find cdrecord; assuming %s", output); … … 612 621 } 613 622 } 623 paranoid_free(tmp); 614 624 615 625 asprintf(&command, "%s -scanbus 2> /dev/null", cdr_exe); -
trunk/mondo/mondo/common/libmondo-filelist.c
r688 r689 479 479 int get_acl_list(char *filelist, char *facl_fname) 480 480 { 481 char *command; 481 char *command = NULL; 482 char *tmp = NULL; 482 483 int retval = 0; 483 484 … … 486 487 paranoid_free(command); 487 488 488 if (find_home_of_exe("getfacl")) { 489 tmp = find_home_of_exe("getfacl"); 490 if (tmp) { 489 491 // sort_file(filelist); // FIXME - filelist chopper sorts, so this isn't necessary 490 492 asprintf(&command, … … 495 497 paranoid_free(command); 496 498 } 499 paranoid_free(tmp); 497 500 return (retval); 498 501 } … … 501 504 int get_fattr_list(char *filelist, char *fattr_fname) 502 505 { 503 char *command; 506 char *command = NULL; 507 char *tmp = NULL; 504 508 int retval = 0; 505 509 … … 508 512 paranoid_free(command); 509 513 510 if (find_home_of_exe("getfattr")) { 514 tmp = find_home_of_exe("getfattr"); 515 if (tmp) { 511 516 // sort_file(filelist); // FIXME - filelist chopper sorts, so this isn't necessary 512 517 retval = … … 514 519 fattr_fname); 515 520 } 521 paranoid_free(tmp); 516 522 return (retval); 517 523 } -
trunk/mondo/mondo/common/libmondo-files.c
r688 r689 738 738 if (0 == strncmp(fname, "/dev/", 5)) { 739 739 if (is_dev_an_NTFS_dev(fname)) { 740 if ( !find_home_of_exe("ntfsresize")) { 740 tmp = find_home_of_exe("ntfsresize"); 741 if (!tmp) { 741 742 fatal_error("ntfsresize not found"); 742 743 } 744 paranoid_free(tmp); 745 743 746 asprintf(&command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", fname); 744 747 log_it("command = %s", command); -
trunk/mondo/mondo/common/libmondo-fork.c
r688 r689 510 510 // BACKUP 511 511 int res = -1; 512 char*command; 512 char *command = NULL; 513 char *tmp = NULL; 513 514 514 515 if (!does_file_exist(input_device)) { 515 516 fatal_error("input device does not exist"); 516 517 } 517 if ( !find_home_of_exe("ntfsclone")) { 518 tmp = find_home_of_exe("ntfsclone"); 519 if (!tmp) { 518 520 fatal_error("ntfsclone not found"); 519 521 } 520 malloc_string(command); 521 sprintf(command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device); 522 paranoid_free(tmp); 523 524 asprintf(&command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device); 522 525 res = run_program_and_log_output(command, 5); 523 526 paranoid_free(command); 527 524 528 unlink(output_fname); 525 529 return (res); … … 678 682 // RESTORE 679 683 int res = -1; 680 char *command; 681 682 if ( !find_home_of_exe("ntfsclone")) { 684 char *command = NULL; 685 char *tmp = NULL; 686 687 tmp = find_home_of_exe("ntfsclone"); 688 if (!tmp) { 683 689 fatal_error("ntfsclone not found"); 684 690 } 691 paranoid_free(tmp); 692 685 693 asprintf(&command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo); 686 694 res = run_program_and_log_output(command, 5); -
trunk/mondo/mondo/common/libmondo-raid.c
r688 r689 403 403 * @return 0 if the line was read and stored successfully, 1 if we're at end of file. 404 404 */ 405 int get_next_raidtab_line(FILE * 405 int get_next_raidtab_line(FILE *fin, char *label, char *value) 406 406 { 407 407 char *incoming = NULL; 408 char *p ;408 char *p = NULL; 409 409 size_t n = 0; 410 410 411 411 assert(fin != NULL); 412 assert(label != NULL); 413 assert(value != NULL); 414 415 label[0] = value[0] = '\0'; 412 416 413 if (feof(fin)) { 417 414 return (1); … … 429 426 p++; 430 427 } 431 strcpy(label, incoming); 432 strcpy(value, p); 433 paranoid_free(incoming); 428 label = incoming; 429 value = p; 434 430 return (0); 435 431 } … … 576 572 char *fname) 577 573 { 578 FILE *fin ;579 char *label ;580 char *value ;574 FILE *fin = NULL; 575 char *label = NULL; 576 char *value = NULL; 581 577 int items; 582 578 int v; … … 596 592 items = 0; 597 593 log_it("Loading raidtab..."); 598 malloc_string(label);599 malloc_string(value);600 594 get_next_raidtab_line(fin, label, value); 601 595 while (!feof(fin)) { … … 605 599 /* find the 'raiddev' entry, indicating the start of the block of info */ 606 600 while (!feof(fin) && strcmp(label, "raiddev")) { 607 strcpy(raidlist->el[items].additional_vars.el[v].label, label);608 strcpy(raidlist->el[items].additional_vars.el[v].value, value);601 raidlist->el[items].additional_vars.el[v].label = label; 602 raidlist->el[items].additional_vars.el[v].value = value; 609 603 v++; 610 604 get_next_raidtab_line(fin, label, value); … … 616 610 } 617 611 log_msg(2, "Record #%d (%s) found", items, value); 618 strcpy(raidlist->el[items].raid_device, value);612 raidlist->el[items].raid_device = value; 619 613 for (get_next_raidtab_line(fin, label, value); 620 614 !feof(fin) && strcmp(label, "raiddev"); … … 628 622 log_msg(1, "Raidtab loaded successfully."); 629 623 log_msg(1, "%d RAID devices in raidtab", items); 630 paranoid_free(label);631 paranoid_free(value);632 624 return (0); 633 625 } … … 644 636 */ 645 637 void 646 process_raidtab_line(FILE * 638 process_raidtab_line(FILE *fin, 647 639 struct raid_device_record *raidrec, 648 640 char *label, char *value) … … 650 642 651 643 /*@ add mallocs * */ 652 char *tmp; 653 char *labelB; 654 char *valueB; 655 656 struct list_of_disks *disklist; 657 int index; 658 int v; 659 660 malloc_string(labelB); 661 malloc_string(valueB); 644 char *tmp = NULL; 645 char *labelB = NULL; 646 char *valueB = NULL; 647 648 struct list_of_disks *disklist = NULL; 649 int index = 0; 650 int v = 0; 651 662 652 assert(fin != NULL); 663 653 assert(raidrec != NULL); … … 716 706 add_disk_to_raid_device(disklist, value, index); 717 707 } 708 paranoid_free(labelB); 709 paranoid_free(valueB); 718 710 } else { 719 711 v = raidrec->additional_vars.entries; 720 strcpy(raidrec->additional_vars.el[v].label, label);721 strcpy(raidrec->additional_vars.el[v].value, value);712 raidrec->additional_vars.el[v].label = label; 713 raidrec->additional_vars.el[v].value = value; 722 714 raidrec->additional_vars.entries = ++v; 723 715 } 724 paranoid_free(labelB);725 paranoid_free(valueB);726 716 } 727 717 #endif -
trunk/mondo/mondo/common/libmondo-stream.c
r688 r689 222 222 dev = NULL; 223 223 siz = NULL; 224 if (find_home_of_exe("cdrecord")) { 224 tmp = find_home_of_exe("cdrecord"); 225 if (tmp) { 225 226 asprintf(&cdr_exe, "cdrecord"); 226 227 } else { 227 228 asprintf(&cdr_exe, "dvdrecord"); 228 229 } 230 paranoid_free(tmp); 231 229 232 asprintf(&command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", 230 233 cdr_exe); -
trunk/mondo/mondo/common/libmondo-tools.c
r688 r689 348 348 char *extra_cdrom_params = NULL; 349 349 char *mondo_mkisofs_sz = NULL; 350 char *command ;351 char *hostname , *ip_address;350 char *command = NULL; 351 char *hostname = NULL, *ip_address = NULL; 352 352 int retval = 0; 353 353 long avm = 0; 354 char *colon ;355 char *cdr_exe ;356 char *tmp ;357 char *tmp1 ;354 char *colon = NULL; 355 char *cdr_exe = NULL; 356 char *tmp = NULL; 357 char *tmp1 = NULL; 358 358 char call_before_iso_user[MAX_STR_LEN] = "\0"; 359 359 int rdsiz_MB; 360 char *iso_path ;360 char *iso_path = NULL; 361 361 362 362 assert(bkpinfo != NULL); … … 439 439 440 440 if (bkpinfo->backup_media_type == dvd) { 441 if (!(find_home_of_exe("growisofs"))) { 441 tmp = find_home_of_exe("growisofs"); 442 if (!tmp) { 442 443 fatal_error("Please install growisofs."); 443 444 } 445 paranoid_free(tmp); 446 444 447 if (bkpinfo->nonbootable_backup) { 445 448 asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT); … … 502 505 } 503 506 } 504 if (find_home_of_exe("cdrecord")) { 507 tmp = find_home_of_exe("cdrecord"); 508 tmp1 = find_home_of_exe("dvdrecord"); 509 if (tmp) { 505 510 asprintf(&cdr_exe, "cdrecord"); 506 } else if ( find_home_of_exe("dvdrecord")) {511 } else if (tmp1) { 507 512 asprintf(&cdr_exe, "dvdrecord"); 508 513 } else { 509 514 fatal_error("Please install either cdrecord or dvdrecord."); 510 515 } 516 paranoid_free(tmp); 517 paranoid_free(tmp1); 518 511 519 if (bkpinfo->nonbootable_backup) { 512 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); … … 829 837 830 838 /*@ buffers ************ */ 831 char *tmp ;839 char *tmp = NULL; 832 840 833 841 /*@ int's *************** */ … … 913 921 /* IA64 always has one vfat partition for EFI even without Windows */ 914 922 // retval += 915 if (!find_home_of_exe("ms-sys")) { 923 tmp = find_home_of_exe("ms-sys"); 924 if (!tmp) { 916 925 log_to_screen(_("Please install ms-sys just in case.")); 917 926 } 918 #endif 919 } 920 921 if (!find_home_of_exe("cmp")) { 922 if (!find_home_of_exe("true")) { 923 whine_if_not_found("cmp"); 924 } else { 925 log_to_screen 926 (_("Your system lacks the 'cmp' binary. I'll create a dummy cmp for you.")); 927 if (run_program_and_log_output 928 ("cp -f `which true` /usr/bin/cmp", 0)) { 929 fatal_error("Failed to create dummy 'cmp' file."); 930 } 931 } 932 } 927 paranoid_free(tmp); 928 #endif 929 } 930 931 tmp = find_home_of_exe("cmp"); 932 if (!tmp) { 933 whine_if_not_found("cmp"); 934 } 935 paranoid_free(tmp); 936 933 937 run_program_and_log_output 934 938 ("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5); -
trunk/mondo/mondo/mondoarchive/mondo-cli.c
r688 r689 216 216 217 217 /*@ buffers ** */ 218 char *tmp ;219 char *tmp1 ;220 char *psz ;221 char *p ;222 char *q ;218 char *tmp = NULL; 219 char *tmp1 = NULL; 220 char *psz = NULL; 221 char *p = NULL; 222 char *q = NULL; 223 223 224 224 long itbs; … … 263 263 } 264 264 265 if (!find_home_of_exe("afio")) { 266 if (find_home_of_exe("star")) { 265 tmp = find_home_of_exe("afio"); 266 tmp1 = find_home_of_exe("star"); 267 if (!tmp) { 268 if (tmp1) { 267 269 flag_set['R'] = TRUE; 268 270 log_msg(1, "Using star instead of afio"); … … 272 274 } 273 275 } 276 paranoid_free(tmp); 274 277 275 278 if (flag_set['R']) { … … 278 281 fatal_error("You may not use star and lzop at the same time."); 279 282 } 280 if (! find_home_of_exe("star")) {283 if (!tmp1) { 281 284 fatal_error 282 285 ("Please install 'star' RPM or tarball if you are going to use -R. Thanks."); 283 286 } 284 287 } 288 paranoid_free(tmp1); 289 285 290 if (flag_set['W']) { 286 291 bkpinfo->nonbootable_backup = TRUE; … … 432 437 } 433 438 } 434 if (!find_home_of_exe("growisofs")) { 439 tmp = find_home_of_exe("growisofs"); 440 if (!tmp) { 435 441 fatal_error 436 442 ("Please install growisofs (probably part of dvd+rw-tools). If you want DVD support, you need it."); 437 443 } 438 if (!find_home_of_exe("dvd+rw-format")) { 444 paranoid_free(tmp); 445 446 tmp = find_home_of_exe("dvd+rw-format"); 447 if (!tmp) { 439 448 fatal_error 440 449 ("Please install dvd+rw-format (probably part of dvd+rw-tools). If you want DVD support, you need it."); 441 450 } 451 paranoid_free(tmp); 452 442 453 if (strchr(flag_val['d'], ',')) { 443 454 fatal_error -
trunk/mondo/mondo/mondorestore/mondo-prep.c
r688 r689 203 203 iamhere("STARTING"); 204 204 log_msg(1, "OK, opened i-want-my-lvm. Shutting down LVM volumes..."); 205 if (find_home_of_exe("lvm")) // found it :) cool 205 tmp = find_home_of_exe("lvm"); 206 if (tmp) // found it :) cool 206 207 { 207 208 asprintf(&lvscan_sz, "lvm lvscan"); … … 219 220 asprintf(&vgremove_sz, "vgremove"); 220 221 } 222 paranoid_free(tmp); 223 221 224 asprintf(&command, 222 225 "for i in `%s | cut -d\"'\" -f2 | sort -r` ; do echo \"Shutting down lv $i\" >> " -
trunk/mondo/mondo/mondorestore/mondo-restore.c
r688 r689 2049 2049 asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2050 2050 asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH); 2051 if (length_of_file(acl_fname) > 0 && find_home_of_exe("setfacl")) { 2051 tmp = find_home_of_exe("setfacl"); 2052 if (length_of_file(acl_fname) > 0 && tmp) { 2052 2053 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname); 2053 2054 } 2054 if (length_of_file(xattr_fname) > 0 2055 && find_home_of_exe("setfattr")) { 2055 paranoid_free(tmp); 2056 2057 tmp = find_home_of_exe("setfattr"); 2058 if (length_of_file(xattr_fname) > 0 && tmp) { 2056 2059 set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname); 2057 2060 } 2061 paranoid_free(tmp); 2058 2062 paranoid_free(acl_fname); 2059 2063 paranoid_free(xattr_fname); … … 2566 2570 log_msg(1, "path is now %s", newpath); 2567 2571 log_msg(1, "restoring everything"); 2568 if (!find_home_of_exe("petris") && !g_text_mode) { 2572 tmp = find_home_of_exe("petris"); 2573 if (!tmp && !g_text_mode) { 2569 2574 newtDrawRootText(0, g_noof_rows - 2, 2570 2575 _ … … 2572 2577 newtRefresh(); 2573 2578 } 2579 paranoid_free(tmp); 2580 2574 2581 mvaddstr_and_log_it(g_currentY, 0, 2575 2582 _("Preparing to read your archives")); -
trunk/mondo/mondo/mondorestore/mondo-rstr-compare.c
r688 r689 68 68 return (1); 69 69 } 70 paranoid_free(tmp1); 71 70 72 fread((void *) &biggiestruct, 1, sizeof(biggiestruct), fin); 71 73 paranoid_fclose(fin); … … 251 253 252 254 if (compressor_exe != NULL) { 253 if (!find_home_of_exe(compressor_exe)) { 255 tmp = find_home_of_exe(compressor_exe); 256 if (!tmp) { 254 257 fatal_error("(compare_a_tarball) Compression program missing"); 255 258 } 259 paranoid_free(tmp); 256 260 if (use_star) { 257 261 if (strcmp(compressor_exe, "bzip2")) { -
trunk/mondo/mondo/mondorestore/mondo-rstr-tools.c
r688 r689 659 659 asprintf(&p1, "-o ro"); 660 660 } 661 if (find_home_of_exe("setfattr")) { 661 tmp = find_home_of_exe("setfattr"); 662 if (tmp) { 662 663 asprintf(&p2, ",user_xattr"); 663 664 } else { 664 665 asprintf(&p2, ""); 665 666 } 666 if (find_home_of_exe("setfacl")) { 667 paranoid_free(tmp); 668 669 tmp = find_home_of_exe("setfacl"); 670 if (tmp) { 667 671 asprintf(&p3, ",acl"); 668 672 } else { 669 673 asprintf(&p3, ""); 670 674 } 675 paranoid_free(tmp); 676 671 677 asprintf(&additional_parameters, "%s%s%s", p1, p2, p3); 672 678 paranoid_free(p1); … … 1374 1380 { 1375 1381 char *output = NULL; 1382 char *tmp = NULL; 1376 1383 1377 1384 /* BERLIOS: This should use $EDITOR + conf file rather first */ 1378 if (find_home_of_exe("pico")) { 1385 tmp = find_home_of_exe("pico"); 1386 if (tmp) { 1379 1387 asprintf(&output, "pico"); 1380 } else if (find_home_of_exe("nano")) { 1381 asprintf(&output, "nano"); 1382 } else if (find_home_of_exe("e3em")) { 1383 asprintf(&output, "e3em"); 1384 } else if (find_home_of_exe("e3vi")) { 1385 asprintf(&output, "e3vi"); 1386 } else { 1387 asprintf(&output, "vi"); 1388 } 1389 if (!find_home_of_exe(output)) { 1388 } else { 1389 tmp = find_home_of_exe("nano"); 1390 if (tmp) { 1391 asprintf(&output, "nano"); 1392 } else { 1393 tmp = find_home_of_exe("vi"); 1394 if (tmp) { 1395 asprintf(&output, "vi"); 1396 } else { 1397 asprintf(&output, "emacs"); 1398 } 1399 } 1400 } 1401 paranoid_free(tmp); 1402 1403 tmp = find_home_of_exe(output); 1404 if (!tmp) { 1390 1405 log_msg(2, " (find_my_editor) --- warning - %s not found", output); 1391 1406 } 1407 paranoid_free(tmp); 1392 1408 return (output); 1393 1409 }
Note:
See TracChangeset
for help on using the changeset viewer.