Changeset 1176 in MondoRescue for trunk/mondo/src/common/libmondo-raid.c
- Timestamp:
- Feb 16, 2007, 2:16:14 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/src/common/libmondo-raid.c
r1106 r1176 10 10 #include "my-stuff.h" 11 11 #include "mr_str.h" 12 #include "mr_mem.h" 13 #include "mr_msg.h" 14 12 15 #include "mondostructures.h" 13 16 #include "newt-specific-EXT.h" … … 16 19 #include "libmondo-string-EXT.h" 17 20 #include "libmondo-raid.h" 18 #include "mr_mem.h"19 #include "mr_str.h"20 #include "mr_mem.h"21 21 22 22 #ifdef __FreeBSD__ … … 47 47 #else 48 48 /*@ buffer ********************************************************** */ 49 char *command ;50 int res ;49 char *command = NULL; 50 int res = 0; 51 51 52 52 if (raidno == -1) { … … 228 228 #endif 229 229 230 230 231 /** 231 232 * Save the additional RAID variables to a stream. … … 316 317 #ifdef __FreeBSD__ 317 318 int i, j; 319 char *org = NULL; 318 320 319 321 fprintf(fout, "\nvolume %s\n", raidrec->volname); 320 322 for (i = 0; i < raidrec->plexes; ++i) { 321 char *org;322 323 switch (raidrec->plex[i].raidlevel) { 323 324 case -1: 324 mr_asprintf(&org, " %s", "concat");325 mr_asprintf(&org, "concat"); 325 326 break; 326 327 case 0: 327 mr_asprintf(&org, " %s", "striped");328 mr_asprintf(&org, "striped"); 328 329 break; 329 330 case 5: 330 mr_asprintf(&org, " %s", "raid5");331 mr_asprintf(&org, "raid5"); 331 332 break; 332 333 } … … 422 423 for (mr_getline(&incoming, &n, fin); !feof(fin); 423 424 mr_getline(&incoming, &n, fin)) { 424 strip_spaces(incoming);425 mr_strip_spaces(incoming); 425 426 p = strchr(incoming, ' '); 426 427 if (strlen(incoming) < 3 || incoming[0] == '#' || !p) { … … 450 451 char *fname) 451 452 { 452 FILE *fin; 453 char *tmp1; 454 int items; 453 FILE *fin = NULL; 454 int items = 0; 455 455 456 456 raidlist->spares.entries = 0; … … 499 499 } 500 500 } else if (!strcmp(argv[0], "volume")) { 501 char *volname ;501 char *volname = NULL; 502 502 if (argc < 2) 503 503 continue; … … 508 508 } else if (!strcmp(argv[0], "plex")) { 509 509 int raidlevel, stripesize; 510 char *org = 0;511 char **tmp = 0;510 char *org = NULL; 511 char **tmp = NULL; 512 512 if (argc < 3) 513 513 continue; … … 546 546 } else if ((!strcmp(argv[0], "sd")) 547 547 || (!strcmp(argv[0], "subdisk"))) { 548 char *drive = 0;548 char *drive = NULL; 549 549 if (argc < 3) 550 550 continue; … … 565 565 fclose(fin); 566 566 log_it("Raidtab loaded successfully."); 567 mr_asprintf(&tmp1, "%d RAID devices in raidtab", raidlist->entries); 568 log_it(tmp1); 569 mr_free(tmp1); 567 log_it("%d RAID devices in raidtab", raidlist->entries); 570 568 return (0); 571 569 } … … 647 645 648 646 /*@ add mallocs * */ 649 char *tmp = NULL;650 647 char *labelB = NULL; 651 648 char *valueB = NULL; … … 701 698 } 702 699 if (!disklist) { 703 mr_asprintf(&tmp, 704 "Ignoring '%s %s' pair of disk %s", labelB, valueB, 705 label); 706 log_it(tmp); 707 mr_free(tmp); 700 log_it("Ignoring '%s %s' pair of disk %s", labelB, valueB, 701 label); 708 702 } else { 709 703 add_disk_to_raid_device(disklist, value, atoi(valueB)); … … 932 926 const char delims[] = " "; 933 927 934 FILE *fin; 935 int row, i, index_min; 928 FILE *fin = NULL; 929 int row = 0; 930 int i = 0; 931 int index_min = 0; 936 932 int lastpos = 0; 937 933 size_t len = 0; 938 char *token;934 char *token = NULL; 939 935 char *string = NULL; 940 char *pos ;941 char type ;942 char *strtmp ;936 char *pos = NULL; 937 char type = NULL; 938 char *strtmp = NULL; 943 939 944 940 // open file … … 982 978 mr_asprintf(&strtmp,"%s%s", device_prefix, token); 983 979 raidlist->el[raidlist->entries].raid_device = strtmp; 980 mr_free(strtmp); 984 981 mr_free(token); 985 982 // skip ':' and status
Note:
See TracChangeset
for help on using the changeset viewer.