Changeset 2357 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-raid.c
- Timestamp:
- Aug 29, 2009, 3:22:10 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-raid.c
r2334 r2357 427 427 int get_next_raidtab_line(FILE * fin, char *label, char *value) 428 428 { 429 char *incoming ;429 char *incoming = NULL; 430 430 char *p; 431 431 432 malloc_string(incoming);433 432 assert(fin != NULL); 434 433 assert(label != NULL); … … 437 436 label[0] = value[0] = '\0'; 438 437 if (feof(fin)) { 439 paranoid_free(incoming);440 438 return (1); 441 439 } 442 for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin); 443 fgets(incoming, MAX_STR_LEN - 1, fin)) { 444 strip_spaces(incoming); 440 for (mr_getline(incoming, fin); !feof(fin); mr_getline(incoming, fin)) { 441 mr_strip_spaces(incoming); 445 442 p = strchr(incoming, ' '); 446 443 if (strlen(incoming) < 3 || incoming[0] == '#' || !p) { 444 mr_free(incoming); 447 445 continue; 448 446 } … … 453 451 strcpy(label, incoming); 454 452 strcpy(value, p); 455 paranoid_free(incoming);453 mr_free(incoming); 456 454 return (0); 457 455 } 456 mr_free(incoming); 458 457 return (1); 459 458 } … … 805 804 static char *argv[64]; 806 805 char **ap; 807 char *line = (char *) malloc(MAX_STR_LEN); 808 if (!line) 809 errx(1, 810 "unable to allocate %i bytes of memory for `char *line' at %s:%i", 811 MAX_STR_LEN, __FILE__, __LINE__); 812 (void) fgets(line, MAX_STR_LEN, f); 806 char *line = NULL; 807 808 mr_getline(line, f); 813 809 if (feof(f)) { 814 810 log_it("[GNVCL] Uh... I reached the EOF."); … … 822 818 cnt++; 823 819 } 820 mr_free(line); 824 821 825 822 if (strchr(argv[cnt - 1], '\n')) {
Note:
See TracChangeset
for help on using the changeset viewer.