Ignore:
Timestamp:
Nov 10, 2012, 5:05:37 AM (11 years ago)
Author:
Bruno Cornec
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-fork.c

    r3042 r3060  
    3939    static char result[MAX_STR_LEN];
    4040    char *tmp;
     41    char *p;
    4142
    4243    /*@ pointers **************************************************** */
     
    5253    assert_string_is_neither_NULL_nor_zerolength(call);
    5354    if ((fin = popen(call, "r"))) {
    54         for (fgets(tmp, MAX_STR_LEN, fin); !feof(fin);
    55              fgets(tmp, MAX_STR_LEN, fin)) {
     55        for (p = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (p != NULL);
     56             p = fgets(tmp, MAX_STR_LEN, fin)) {
    5657            if (strlen(tmp) > 1) {
    5758                strcpy(result, tmp);
     
    267268    FILE *fin;
    268269    char *p;
     270    char *q;
    269271
    270272    /*@ end vars *************************************************** */
     
    312314    fin = fopen(tmp1, "r");
    313315    if (fin) {
    314         for (fgets(incoming, MAX_STR_LEN, fin); !feof(fin); fgets(incoming, MAX_STR_LEN, fin)) {
     316        for (q = fgets(incoming, MAX_STR_LEN, fin); !feof(fin) && (q != NULL); q = fgets(incoming, MAX_STR_LEN, fin)) {
    315317            p = incoming;
    316318            while (p && *p) {
     
    562564                log_msg(1, "bytes_read_in = %ld", bytes_read_in);
    563565//      if (bytes_read_in!=128+64) { fatal_error("Can't read the terminating block"); }
    564                 fwrite(tmp, 1, bytes_read_in, ftmp);
     566                if (fwrite(tmp, 1, bytes_read_in, ftmp)) {
     567                    fatal_error("Can't fwrite here");
     568                }
    565569                sprintf(tmp, "I am here - %lld", (long long)ftello(fin));
    566570//    log_msg(0, tmp);
    567                 fread(tmp, 1, tmpcap, fin);
     571                if (fread(tmp, 1, tmpcap, fin)) {
     572                    fatal_error("Can't fread here");
     573                }
    568574                log_msg(0, "tmp = '%s'", tmp);
    569                 fwrite(tmp, 1, tmpcap, ftmp);
     575                if (fwrite(tmp, 1, tmpcap, ftmp)) {
     576                    fatal_error("Can't fwrite there");
     577                }
    570578                fclose(ftmp);
    571579                fatal_error("Missing terminating block");
Note: See TracChangeset for help on using the changeset viewer.