Ignore:
Timestamp:
Nov 10, 2012, 5:05:37 AM (7 years ago)
Author:
bruno
Message:

r5035@localhost: bruno | 2012-11-09 03:17:01 +0100

  • Fix a compilation error and most compilation warnings
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mondo/src/common/libmondo-raid.c

    r3043 r3060  
    429429    char *incoming;
    430430    char *p;
     431    char *q;
    431432
    432433    malloc_string(incoming);
     
    440441        return (1);
    441442    }
    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)) {
    444445        strip_spaces(incoming);
    445446        p = strchr(incoming, ' ');
     
    810811    static char *argv[64];
    811812    char **ap;
     813    char *q;
    812814    char *line = (char *) malloc(MAX_STR_LEN);
     815
    813816    if (!line)
    814817        errx(1,
    815818             "unable to allocate %i bytes of memory for `char *line' at %s:%i",
    816819             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)) {
    819822        log_it("[GNVCL] Uh... I reached the EOF.");
    820823        return 0;
     
    10311034            mr_asprintf(&strtmp,"%s%s", device_prefix, token);
    10321035            strncpy(raidlist->el[raidlist->entries].raid_device, strtmp, 63);
    1033             raidlist->el[raidlist->entries].raid_device[64] = '\0';
     1036            raidlist->el[raidlist->entries].raid_device[63] = '\0';
    10341037            mr_free(strtmp);
    10351038            mr_free(token);
Note: See TracChangeset for help on using the changeset viewer.