--- projects/libstatgrab/src/libstatgrab/network_stats.c 2004/02/12 23:58:32 1.28 +++ projects/libstatgrab/src/libstatgrab/network_stats.c 2004/02/13 14:39:34 1.29 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA * - * $Id: network_stats.c,v 1.28 2004/02/12 23:58:32 tdb Exp $ + * $Id: network_stats.c,v 1.29 2004/02/13 14:39:34 pajs Exp $ */ #ifdef HAVE_CONFIG_H @@ -339,7 +339,7 @@ void network_iface_stat_init(int start, int end, netwo for(net_stats+=start; startinterface_name=NULL; net_stats->speed=0; - net_stats->dup=NO_DUPLEX; + net_stats->dup=UNKNOWN_DUPEX; net_stats++; } } @@ -469,7 +469,7 @@ network_iface_stat_t *get_network_iface_stats(int *ent }else if( (ifmed.ifm_active | IFM_HDX) == ifmed.ifm_active ){ network_iface_stat_ptr->dup = HALF_DUPLEX; }else{ - network_iface_stat_ptr->dup = NO_DUPLEX; + network_iface_stat_ptr->dup = UNKNOWN_DUPEX; } ifaces++; } @@ -532,8 +532,8 @@ network_iface_stat_t *get_network_iface_stats(int *ent if(eth_tool_cmd_buf == NULL) return NULL; /* Ignore first 2 lines.. Just headings */ - fgets(line, sizeof(line), f); - fgets(line, sizeof(line), f); + if((fgets(line, sizeof(line), f)) == NULL) return NULL; + if((fgets(line, sizeof(line), f)) == NULL) return NULL; while((fgets(line, sizeof(line), f)) != NULL){ char *name, *ptr; @@ -555,7 +555,7 @@ network_iface_stat_t *get_network_iface_stats(int *ent ifr.ifr_data = (caddr_t) eth_tool_cmd_buf; strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - ethcmd = (struct ethtool_cmd *)(&ifr)->ifr_data; + ethcmd = (struct ethtool_cmd *) ifr.ifr_data; ethcmd->cmd = ETHTOOL_GSET; err = ioctl(sock, SIOCETHTOOL, &ifr); @@ -574,7 +574,7 @@ network_iface_stat_t *get_network_iface_stats(int *ent network_iface_stat_ptr = network_iface_stats + ifaces; network_iface_stat_ptr->interface_name = strdup(name); network_iface_stat_ptr->speed = ethcmd->speed; - network_iface_stat_ptr->dup = NO_DUPLEX; + network_iface_stat_ptr->dup = UNKNOWN_DUPEX; if(ethcmd->duplex == 0x00){ network_iface_stat_ptr->dup = FULL_DUPLEX; }