Ignore:
Timestamp:
Aug 29, 2009, 3:22:10 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Some more fgets => mr_getline transformations
  • XWIN define is gone
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-mountlist.c

    r2352 r2357  
    821821        return (1);
    822822    }
    823     malloc_string(incoming);
    824823    malloc_string(siz);
    825     (void) fgets(incoming, MAX_STR_LEN - 1, fin);
    826824    log_it("Loading mountlist...");
     825    mr_getline(incoming, fin);
    827826    while (!feof(fin)) {
    828827#if linux
    829         res = sscanf(incoming,
    830                "%s %s %s %s %s",
    831                mountlist->el[items].device,
    832                mountlist->el[items].mountpoint,
    833                mountlist->el[items].format,
    834                siz, mountlist->el[items].label);
     828        res = sscanf(incoming, "%s %s %s %s %s", mountlist->el[items].device, mountlist->el[items].mountpoint, mountlist->el[items].format, siz, mountlist->el[items].label);
    835829        if (res < 5) {
    836830            /* no label found */
     
    839833        }
    840834#elif __FreeBSD__
    841         res = sscanf(incoming,
    842                "%s %s %s %s",
    843                mountlist->el[items].device,
    844                mountlist->el[items].mountpoint,
    845                mountlist->el[items].format, siz);
     835        res = sscanf(incoming, "%s %s %s %s", mountlist->el[items].device, mountlist->el[items].mountpoint, mountlist->el[items].format, siz);
    846836        strcpy(mountlist->el[items].label,"");
    847837#endif
     
    854844            !strcmp(mountlist->el[items].device, "devpts")
    855845            ) {
    856             log_msg(1,
    857                     "Ignoring %s in mountlist - not loading that line :) ",
    858                     mountlist->el[items].device);
    859             (void) fgets(incoming, MAX_STR_LEN - 1, fin);
     846            log_msg(1, "Ignoring %s in mountlist - not loading that line :) ", mountlist->el[items].device);
     847            mr_free(incoming);
     848            mr_getline(incoming, fin);
    860849            continue;
    861850        }
     
    880869                    *(p + 2) = *(p + 3);
    881870                }
    882                 log_it("It was %s; it is now %s",
    883                        mountlist->el[items].device, tmp);
     871                log_it("It was %s; it is now %s", mountlist->el[items].device, tmp);
    884872                strcpy(mountlist->el[items].device, tmp);
    885873            }
    886874            paranoid_free(tmp);
    887875
    888             log_it("%s %s %s %lld %s",
    889                      mountlist->el[items].device,
    890                      mountlist->el[items].mountpoint,
    891                      mountlist->el[items].format,
    892                      mountlist->el[items].size,
    893                      mountlist->el[items].label);
     876            log_it("%s %s %s %lld %s", mountlist->el[items].device, mountlist->el[items].mountpoint, mountlist->el[items].format, mountlist->el[items].size, mountlist->el[items].label);
    894877            items++;
    895878            if (items >= MAX_MOUNTLIST_ENTRIES) {
     
    898881            }
    899882        }
    900         (void) fgets(incoming, MAX_STR_LEN - 1, fin);
    901     }
     883        mr_free(incoming);
     884        mr_getline(incoming, fin);
     885    }
     886    mr_free(incoming);
    902887    paranoid_fclose(fin);
    903888    mountlist->entries = items;
     
    906891    log_it("%d entries in mountlist", items);
    907892
    908     paranoid_free(incoming);
    909893    paranoid_free(siz);
    910894    return (0);
Note: See TracChangeset for help on using the changeset viewer.