Fixes for a bunch of compiler warnings.
This commit is contained in:
@@ -90,28 +90,23 @@ get_addrs_ioctl(char *interface, char if_hw_addr[], struct in_addr *if_ip_addr,
|
||||
sysctlparam[5] = if_nametoindex(interface);
|
||||
if (sysctlparam[5] == 0) {
|
||||
fprintf(stderr, "Error getting hardware address for interface: %s\n", interface);
|
||||
goto ENDHWADDR;
|
||||
}
|
||||
if (sysctl(sysctlparam, 6, NULL, &needed, NULL, 0) < 0) {
|
||||
else if (sysctl(sysctlparam, 6, NULL, &needed, NULL, 0) < 0) {
|
||||
fprintf(stderr, "Error getting hardware address for interface: %s\n", interface);
|
||||
goto ENDHWADDR;
|
||||
}
|
||||
if ((buf = malloc(needed)) == NULL) {
|
||||
else if ((buf = malloc(needed)) == NULL) {
|
||||
fprintf(stderr, "Error getting hardware address for interface: %s\n", interface);
|
||||
goto ENDHWADDR;
|
||||
}
|
||||
if (sysctl(sysctlparam, 6, buf, &needed, NULL, 0) < 0) {
|
||||
else if (sysctl(sysctlparam, 6, buf, &needed, NULL, 0) < 0) {
|
||||
fprintf(stderr, "Error getting hardware address for interface: %s\n", interface);
|
||||
free(buf);
|
||||
goto ENDHWADDR;
|
||||
}
|
||||
msghdr = (struct if_msghdr *) buf;
|
||||
memcpy(if_hw_addr, LLADDR((struct sockaddr_dl *)(buf + sizeof(struct if_msghdr) - sizeof(struct if_data) + sizeof(struct if_data))), 6);
|
||||
free(buf);
|
||||
got_hw_addr = 1;
|
||||
|
||||
ENDHWADDR:
|
||||
1; /* compiler whines if there is a label at the end of a block...*/
|
||||
else {
|
||||
msghdr = (struct if_msghdr *) buf;
|
||||
memcpy(if_hw_addr, LLADDR((struct sockaddr_dl *)(buf + sizeof(struct if_msghdr) - sizeof(struct if_data) + sizeof(struct if_data))), 6);
|
||||
free(buf);
|
||||
got_hw_addr = 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
fprintf(stderr, "Cannot obtain hardware address on this platform\n");
|
||||
|
||||
Reference in New Issue
Block a user