From f58b31212909899e04e77c9a89549756c168de5a Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Thu, 23 Jan 2014 17:14:31 +0100 Subject: [PATCH 1/2] improve error messages when tap ioctls fail --- cpu/native/net/tap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cpu/native/net/tap.c b/cpu/native/net/tap.c index 7b7cc4faf1..6d6b8c849b 100644 --- a/cpu/native/net/tap.c +++ b/cpu/native/net/tap.c @@ -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"); } From 7148f1db236f5f753e8e47a948eb7dc2d340da69 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Thu, 23 Jan 2014 17:25:41 +0100 Subject: [PATCH 2/2] change wording addresses https://github.com/RIOT-OS/RIOT/pull/555#discussion_r9118361 --- cpu/native/net/tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/native/net/tap.c b/cpu/native/net/tap.c index 6d6b8c849b..27ed7a8ad3 100644 --- a/cpu/native/net/tap.c +++ b/cpu/native/net/tap.c @@ -262,7 +262,7 @@ int tap_init(char *name) if (ioctl(_native_tap_fd, TUNSETIFF, (void *)&ifr) == -1) { warn("ioctl TUNSETIFF"); - warnx("probably the tap interface (%s) does not exist or is already taken", name); + warnx("probably the tap interface (%s) does not exist or is already in use", name); exit(EXIT_FAILURE); }