X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fethstat.c;h=c5b02d3eb327799af3a6ef45006013e3cce04e2e;hb=0b7cd83a5e6bac068ea83a88a5ddcfb07c09fbec;hp=3c03e36ab6134a20b2a42a0dcb081d7457f5be4a;hpb=88bd89f106abd5c0a9f9a80246e31a16c36a3c6d;p=collectd.git diff --git a/src/ethstat.c b/src/ethstat.c index 3c03e36a..c5b02d3e 100644 --- a/src/ethstat.c +++ b/src/ethstat.c @@ -204,9 +204,7 @@ static int ethstat_read_interface(char *device) { fd = socket(AF_INET, SOCK_DGRAM, /* protocol = */ 0); if (fd < 0) { - char errbuf[1024]; - ERROR("ethstat plugin: Failed to open control socket: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("ethstat plugin: Failed to open control socket: %s", STRERRNO); return 1; } @@ -218,11 +216,10 @@ static int ethstat_read_interface(char *device) { status = ioctl(fd, SIOCETHTOOL, &req); if (status < 0) { - char errbuf[1024]; close(fd); ERROR("ethstat plugin: Failed to get driver information " "from %s: %s", - device, sstrerror(errno, errbuf, sizeof(errbuf))); + device, STRERRNO); return -1; } @@ -252,12 +249,10 @@ static int ethstat_read_interface(char *device) { req.ifr_data = (void *)strings; status = ioctl(fd, SIOCETHTOOL, &req); if (status < 0) { - char errbuf[1024]; close(fd); free(strings); free(stats); - ERROR("ethstat plugin: Cannot get strings from %s: %s", device, - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("ethstat plugin: Cannot get strings from %s: %s", device, STRERRNO); return -1; } @@ -266,12 +261,11 @@ static int ethstat_read_interface(char *device) { req.ifr_data = (void *)stats; status = ioctl(fd, SIOCETHTOOL, &req); if (status < 0) { - char errbuf[1024]; close(fd); free(strings); free(stats); ERROR("ethstat plugin: Reading statistics from %s failed: %s", device, - sstrerror(errno, errbuf, sizeof(errbuf))); + STRERRNO); return -1; }