Author: tjansen Date: Thu Nov 12 14:35:39 2009 New Revision: 1668 Log: Cosmetics: Separate arguments with space and removed unnecessary empty lines. Modified: trunk/libpisa/tunnel.c Modified: trunk/libpisa/tunnel.c ============================================================================== --- trunk/libpisa/tunnel.c Thu Nov 12 14:34:26 2009 (r1667) +++ trunk/libpisa/tunnel.c Thu Nov 12 14:35:39 2009 (r1668) @@ -31,21 +31,18 @@ */ int pisa_tunnel_open_tundev(char* devname, size_t len) { - int fd_tun=-1; - + int fd_tun = -1; struct ifreq ifr; - if ( (fd_tun = open("/dev/net/tun",O_RDWR)) < 0) - die("Couldn't open tunnel device. Are you root?",EXIT_FAILURE); + if ((fd_tun = open("/dev/net/tun", O_RDWR)) < 0) + die("Couldn't open tunnel device. Are you root?", EXIT_FAILURE); memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_flags = IFF_TUN; - strncpy(ifr.ifr_name, "pisaTunnel%d", IFNAMSIZ); if (ioctl(fd_tun, TUNSETIFF, (void *)&ifr) < 0) - die("ioctl on tunnel device failed.",2); + die("ioctl on tunnel device failed.", 2); strncpy(devname, ifr.ifr_name, len); @@ -135,14 +132,14 @@ */ int pisa_tunnel_open_socket(int port) { - int fd_peer=-1; + int fd_peer = -1; struct sockaddr_in6 sin; - int on=1; + int on = 1; fd_peer = socket(AF_INET6, SOCK_DGRAM, 0); if (fd_peer < 0) - die("pisa_tunnel_open_socket: socket creation failed",4); + die("pisa_tunnel_open_socket: socket creation failed", 4); setsockopt(fd_peer, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); @@ -152,8 +149,8 @@ sin.sin6_port = htons(port); /* bind the socket with the local address */ - if ( bind(fd_peer, (struct sockaddr *)&sin, sizeof(sin)) < 0) - die("pisa_tunnel_open_socket: socket-bind failed",4); + if (bind(fd_peer, (struct sockaddr *)&sin, sizeof(sin)) < 0) + die("pisa_tunnel_open_socket: socket-bind failed", 4); return fd_peer; }