Changeset 3060 in MondoRescue for branches/3.0/mondo/src/common/libmondo-raid.c
- Timestamp:
- Nov 10, 2012, 5:05:37 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/common/libmondo-raid.c
r3043 r3060 429 429 char *incoming; 430 430 char *p; 431 char *q; 431 432 432 433 malloc_string(incoming); … … 440 441 return (1); 441 442 } 442 for ( fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);443 fgets(incoming, MAX_STR_LEN - 1, fin)) {443 for (q = fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) && (q != NULL); 444 q = fgets(incoming, MAX_STR_LEN - 1, fin)) { 444 445 strip_spaces(incoming); 445 446 p = strchr(incoming, ' '); … … 810 811 static char *argv[64]; 811 812 char **ap; 813 char *q; 812 814 char *line = (char *) malloc(MAX_STR_LEN); 815 813 816 if (!line) 814 817 errx(1, 815 818 "unable to allocate %i bytes of memory for `char *line' at %s:%i", 816 819 MAX_STR_LEN, __FILE__, __LINE__); 817 (void)fgets(line, MAX_STR_LEN, f);818 if (feof(f) ) {820 q = fgets(line, MAX_STR_LEN, f); 821 if (feof(f) && (q != NULL)) { 819 822 log_it("[GNVCL] Uh... I reached the EOF."); 820 823 return 0; … … 1031 1034 mr_asprintf(&strtmp,"%s%s", device_prefix, token); 1032 1035 strncpy(raidlist->el[raidlist->entries].raid_device, strtmp, 63); 1033 raidlist->el[raidlist->entries].raid_device[6 4] = '\0';1036 raidlist->el[raidlist->entries].raid_device[63] = '\0'; 1034 1037 mr_free(strtmp); 1035 1038 mr_free(token);
Note:
See TracChangeset
for help on using the changeset viewer.