Xinqi Bao's Git
projects
/
slstatus.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
netspeeds: added error condition for openbsd
[slstatus.git]
/
components
/
ip.c
diff --git
a/components/ip.c
b/components/ip.c
index
2d2cbde
..
fce2b66
100644
(file)
--- a/
components/ip.c
+++ b/
components/ip.c
@@
-5,8
+5,8
@@
#include <stdio.h>
#include <string.h>
#if defined(__OpenBSD__)
#include <stdio.h>
#include <string.h>
#if defined(__OpenBSD__)
-#include <sys/types.h>
-#include <sys/socket.h>
+
#include <sys/types.h>
+
#include <sys/socket.h>
#endif
#include "../util.h"
#endif
#include "../util.h"
@@
-19,7
+19,7
@@
ipv4(const char *iface)
char host[NI_MAXHOST];
if (getifaddrs(&ifaddr) < 0) {
char host[NI_MAXHOST];
if (getifaddrs(&ifaddr) < 0) {
-
fprintf(stderr, "getifaddrs: %s\n", strerror(errno)
);
+
warn("getifaddrs:"
);
return NULL;
}
return NULL;
}
@@
-32,7
+32,7
@@
ipv4(const char *iface)
if (!strcmp(ifa->ifa_name, iface) &&
(ifa->ifa_addr->sa_family == AF_INET)) {
if (s != 0) {
if (!strcmp(ifa->ifa_name, iface) &&
(ifa->ifa_addr->sa_family == AF_INET)) {
if (s != 0) {
-
fprintf(stderr, "getnameinfo: %s\n
", gai_strerror(s));
+
warn("getnameinfo: %s
", gai_strerror(s));
return NULL;
}
return bprintf("%s", host);
return NULL;
}
return bprintf("%s", host);
@@
-52,7
+52,7
@@
ipv6(const char *iface)
char host[NI_MAXHOST];
if (getifaddrs(&ifaddr) < 0) {
char host[NI_MAXHOST];
if (getifaddrs(&ifaddr) < 0) {
-
fprintf(stderr, "getifaddrs: %s\n", strerror(errno)
);
+
warn("getifaddrs:"
);
return NULL;
}
return NULL;
}
@@
-65,7
+65,7
@@
ipv6(const char *iface)
if (!strcmp(ifa->ifa_name, iface) &&
(ifa->ifa_addr->sa_family == AF_INET6)) {
if (s != 0) {
if (!strcmp(ifa->ifa_name, iface) &&
(ifa->ifa_addr->sa_family == AF_INET6)) {
if (s != 0) {
-
fprintf(stderr, "getnameinfo: %s\n
", gai_strerror(s));
+
warn("getnameinfo: %s
", gai_strerror(s));
return NULL;
}
return bprintf("%s", host);
return NULL;
}
return bprintf("%s", host);