Changeset 2407 in MondoRescue
- Timestamp:
- Sep 18, 2009, 1:05:06 AM (15 years ago)
- Location:
- branches/2.2.10/mondo/src/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2406 r2407 504 504 /*@ buffer ************************************************************ */ 505 505 char *tmp = NULL; 506 char *tmp1 = NULL;507 506 char *tmp2 = NULL; 508 507 char *command = NULL; … … 2491 2490 * @return the CD-R(W) device checked or NULL 2492 2491 */ 2493 char *interrogate_disk_currently_in_cdrw_drive( char *cdrw_dev) {2492 char *interrogate_disk_currently_in_cdrw_drive() { 2494 2493 char *cdrecord = NULL; 2495 2494 char *cdrw_dev = NULL; -
branches/2.2.10/mondo/src/common/libmondo-raid.c
r2405 r2407 425 425 * @return 0 if the line was read and stored successfully, 1 if we're at end of file. 426 426 */ 427 int get_next_raidtab_line(FILE * fin, char *label, char*value)427 void get_next_raidtab_line(FILE * fin, char **label, char **value) 428 428 { 429 429 char *incoming = NULL; … … 431 431 432 432 assert(fin != NULL); 433 assert(label != NULL); 434 assert(value != NULL); 435 436 label[0] = value[0] = '\0'; 433 437 434 if (feof(fin)) { 438 return (1);435 return; 439 436 } 440 437 for (mr_getline(incoming, fin); !feof(fin); mr_getline(incoming, fin)) { … … 449 446 p++; 450 447 } 451 strcpy(label, incoming);452 strcpy(value, p);448 mr_asprintf(*label, "%s", incoming); 449 mr_asprintf(*value, "%s", p); 453 450 mr_free(incoming); 454 return (0);451 return; 455 452 } 456 453 mr_free(incoming); 457 return (1);454 return; 458 455 } 459 456 … … 587 584 #else 588 585 589 int load_raidtab_into_raidlist(struct raidlist_itself *raidlist, 590 char *fname) 591 { 592 FILE *fin; 593 char *label; 594 char *value; 586 int load_raidtab_into_raidlist(struct raidlist_itself *raidlist, char *fname) { 587 588 FILE *fin = NULL; 589 char *label = NULL; 590 char *value = NULL; 595 591 int items; 596 592 int v; … … 610 606 items = 0; 611 607 log_it("Loading raidtab..."); 612 malloc_string(label); 613 malloc_string(value); 614 get_next_raidtab_line(fin, label, value); 608 get_next_raidtab_line(fin, &label, &value); 615 609 while (!feof(fin)) { 616 610 log_msg(1, "Looking for raid record #%d", items); … … 622 616 strcpy(raidlist->el[items].additional_vars.el[v].value, value); 623 617 v++; 624 get_next_raidtab_line(fin, label, value); 618 mr_free(label); 619 mr_free(value); 620 get_next_raidtab_line(fin, &label, &value); 625 621 } 626 622 raidlist->el[items].additional_vars.entries = v; … … 631 627 log_msg(2, "Record #%d (%s) found", items, value); 632 628 strcpy(raidlist->el[items].raid_device, value); 633 for (get_next_raidtab_line(fin, label, value);634 !feof(fin) && strcmp(label, "raiddev");635 get_next_raidtab_line(fin, label,value)) {629 mr_free(label); 630 mr_free(value); 631 for (get_next_raidtab_line(fin, &label, &value); !feof(fin) && strcmp(label, "raiddev"); get_next_raidtab_line(fin, &label, &value)) { 636 632 process_raidtab_line(fin, &raidlist->el[items], label, value); 637 } 633 mr_free(label); 634 mr_free(value); 635 } 636 mr_free(label); 637 mr_free(value); 638 638 items++; 639 639 } 640 mr_free(label); 641 mr_free(value); 640 642 paranoid_fclose(fin); 641 643 raidlist->entries = items; 642 644 log_msg(1, "Raidtab loaded successfully."); 643 645 log_msg(1, "%d RAID devices in raidtab", items); 644 paranoid_free(label);645 paranoid_free(value);646 646 return (0); 647 647 } … … 670 670 671 671 /*@ add mallocs * */ 672 char *labelB ;673 char *valueB ;672 char *labelB = NULL; 673 char *valueB = NULL; 674 674 675 675 struct list_of_disks *disklist; … … 677 677 int v; 678 678 679 malloc_string(labelB);680 malloc_string(valueB);681 679 assert(fin != NULL); 682 680 assert(raidrec != NULL); … … 713 711 } 714 712 } else if (!strcmp(label, "device")) { 715 get_next_raidtab_line(fin, labelB,valueB);713 get_next_raidtab_line(fin, &labelB, &valueB); 716 714 if (!strcmp(labelB, "raid-disk")) { 717 715 disklist = &raidrec->data_disks; … … 731 729 add_disk_to_raid_device(disklist, value, index); 732 730 } 731 mr_free(labelB); 732 mr_free(valueB); 733 733 } else { 734 734 v = raidrec->additional_vars.entries; … … 737 737 raidrec->additional_vars.entries = ++v; 738 738 } 739 paranoid_free(labelB);740 paranoid_free(valueB);741 739 } 742 740 #endif
Note:
See TracChangeset
for help on using the changeset viewer.