[pisa-src] r2270 - trunk/libpisa/sysdep_tun.c

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Thu, 15 Apr 2010 11:40:34 +0200

Author: biurrun
Date: Thu Apr 15 11:40:34 2010
New Revision: 2270

Log:
Move system-specific #ifdefs into the pisa_tunnel_open_tundev implementation.
This avoids duplicating the function declaration.

Modified:
   trunk/libpisa/sysdep_tun.c

Modified: trunk/libpisa/sysdep_tun.c
==============================================================================
--- trunk/libpisa/sysdep_tun.c  Wed Apr 14 20:57:25 2010        (r2269)
+++ trunk/libpisa/sysdep_tun.c  Thu Apr 15 11:40:34 2010        (r2270)
@@ -33,12 +33,11 @@
 #endif
 
 
-/* systems like Linux and FreeBSD use a common tunneling interface */
-#ifdef IFF_TUN
-
 /* see the header */
 int pisa_tunnel_open_tundev(char *devicename, size_t len)
 {
+/* systems like Linux and FreeBSD use a common tunneling interface */
+#ifdef IFF_TUN
     int fd_tun;
     struct ifreq ifr;
 
@@ -57,12 +56,7 @@
     strncpy(devicename, ifr.ifr_name, len);
 
     return fd_tun;
-}
-
 #else
-
-int pisa_tunnel_open_tundev(char *devicename, size_t len)
-{
     int i, fd;
     char name[32];
 
@@ -76,6 +70,6 @@
 
     pisa_die("Could not open tunnel device.", EXIT_FAILURE);
     return -1;
+#endif /* IFF_TUN */
 }
 
-#endif /* IFF_TUN */

Other related posts:

  • » [pisa-src] r2270 - trunk/libpisa/sysdep_tun.c - Diego Biurrun