Changeset 1d780e4


Ignore:
Timestamp:
09/01/16 16:27:23 (4 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
ccc598d
Parents:
903f64d
Message:

Fix some basic warnings

Also fixed spelling of 'statistics' in internal function name.

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/format_linux_common.c

    ree6e802 r1d780e4  
    242242
    243243/* These don't typically reset however an interface does exist to reset them */
    244 static int linuxcommon_get_dev_statisitics(libtrace_t *libtrace, struct linux_dev_stats *stats) {
     244static int linuxcommon_get_dev_statistics(libtrace_t *libtrace, struct linux_dev_stats *stats) {
    245245        FILE *file;
    246246        char line[1024];
     
    253253
    254254        /* Skip 2 header lines */
    255         fgets(line, sizeof(line), file);
    256         fgets(line, sizeof(line), file);
     255        if (fgets(line, sizeof(line), file) == NULL) {
     256                fclose(file);
     257                return -1;
     258        }
     259
     260        if (fgets(line, sizeof(line), file) == NULL) {
     261                fclose(file);
     262                return -1;
     263        }
    257264
    258265        while (!(feof(file)||ferror(file))) {
    259266                int tot;
    260                 fgets(line, sizeof(line), file);
     267                if (fgets(line, sizeof(line), file) == NULL)
     268                        break;
     269
    261270                tot = sscanf(line, " %"xstr(IF_NAMESIZE)"[^:]:" REPEAT_16(" %"SCNd64),
    262271                             tmp_stats.if_name,
     
    436445        FORMAT_DATA->stats.tp_drops = 0;
    437446
    438         if (linuxcommon_get_dev_statisitics(libtrace, &FORMAT_DATA->dev_stats) != 0) {
     447        if (linuxcommon_get_dev_statistics(libtrace, &FORMAT_DATA->dev_stats) != 0) {
    439448                /* Mark this as bad */
    440449                FORMAT_DATA->dev_stats.if_name[0] = 0;
     
    527536/* Note these statistics come from two different sources, the socket itself and
    528537 * the linux device. As such this means it is highly likely that their is some
    529  * margin of error in the returned statisitics, we perform basic sanitising so
     538 * margin of error in the returned statistics, we perform basic sanitising so
    530539 * that these are not too noticable.
    531540 */
     
    544553        /* Do we have starting stats to compare to? */
    545554        if (FORMAT_DATA->dev_stats.if_name[0] != 0) {
    546                 linuxcommon_get_dev_statisitics(libtrace, &dev_stats);
     555                linuxcommon_get_dev_statistics(libtrace, &dev_stats);
    547556        }
    548557        linuxcommon_update_socket_statistics(libtrace);
  • lib/format_pcap.c

    r62dec50 r1d780e4  
    345345}
    346346
    347 static int pcap_pause_input(libtrace_t *libtrace)
     347static int pcap_pause_input(libtrace_t *libtrace UNUSED)
    348348{
    349349        return 0; /* success */
Note: See TracChangeset for help on using the changeset viewer.