mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
improve error messages when tap ioctls fail
This commit is contained in:
parent
7f69a6a122
commit
f58b312129
@ -261,10 +261,8 @@ int tap_init(char *name)
|
||||
strncpy(ifr.ifr_name, name, IFNAMSIZ);
|
||||
|
||||
if (ioctl(_native_tap_fd, TUNSETIFF, (void *)&ifr) == -1) {
|
||||
warn("ioctl");
|
||||
if (close(_native_tap_fd) == -1) {
|
||||
warn("close");
|
||||
}
|
||||
warn("ioctl TUNSETIFF");
|
||||
warnx("probably the tap interface (%s) does not exist or is already taken", name);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@ -276,7 +274,7 @@ int tap_init(char *name)
|
||||
memset (&ifr, 0, sizeof (ifr));
|
||||
snprintf (ifr.ifr_name, sizeof (ifr.ifr_name), "%s", name);
|
||||
if (ioctl(_native_tap_fd, SIOCGIFHWADDR, &ifr) == -1) {
|
||||
warn("ioctl");
|
||||
warn("ioctl SIOCGIFHWADDR");
|
||||
if (close(_native_tap_fd) == -1) {
|
||||
warn("close");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user