From 082402df9b3c46a0396b1187fac31c678338cc3a Mon Sep 17 00:00:00 2001 From: Simon Schubert Date: Mon, 11 Feb 2008 22:50:12 +0000 Subject: [PATCH] Report the last error code when searching for a tap device. --- sys/platform/vkernel/platform/init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/platform/vkernel/platform/init.c b/sys/platform/vkernel/platform/init.c index dc3f2b1b99..d72ccf89e8 100644 --- a/sys/platform/vkernel/platform/init.c +++ b/sys/platform/vkernel/platform/init.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/platform/vkernel/platform/init.c,v 1.48 2008/01/29 19:54:59 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/platform/init.c,v 1.49 2008/02/11 22:50:12 corecode Exp $ */ #include @@ -875,6 +875,7 @@ netif_open_tap(const char *netif, int *tap_unit, int s) if (strcmp(netif, "auto") == 0) { int i; + int lasterr = 0; /* * Find first unused tap(4) device file @@ -884,9 +885,10 @@ netif_open_tap(const char *netif, int *tap_unit, int s) tap_fd = open(tap_dev, TAPDEV_OFLAGS); if (tap_fd >= 0 || errno == ENOENT) break; + lasterr = errno; } if (tap_fd < 0) { - warnx("Unable to find a free tap(4)"); + warnc(lasterr, "Unable to find a free tap(4)"); return -1; } } else { -- 2.11.4.GIT