Fix stats on some openbsd drivers (bug #13853)

some driver names are not null-ended (re, nfe?), leading to failing
comparisons. On top of this the comparison was wrong.
Simpler patch than the one provided by Ed Hynan, thanks for the detailed bug
report and thorough analysis.
master
Landry Breuil 2017-11-29 09:59:02 +01:00
parent 8ba226b9bf
commit 5829523b18
1 changed files with 2 additions and 2 deletions

View File

@ -149,10 +149,10 @@ int get_stat(netdata* data)
/* search for the right network interface */
if (sdl->sdl_family != AF_LINK)
continue;
if (strcmp(sdl->sdl_data, data->ifdata.if_name) != 0)
continue;
strncpy(s, sdl->sdl_data, sdl->sdl_nlen);
s[sdl->sdl_nlen] = '\0';
if (strcmp(s, data->ifdata.if_name) != 0)
continue;
rx_o = data->stats.rx_bytes; tx_o = data->stats.tx_bytes;
/* write stats */