Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Oct 2009 20:21:53 +0100 (CET)
From:      Ulrich Spörlein <uqs@spoerlein.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/140060: nos-tun(8) WARNS=3 cleanup
Message-ID:  <200910281921.n9SJLrhG004496@roadrunner.spoerlein.net>
Resent-Message-ID: <200910281930.n9SJU2iB043744@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         140060
>Category:       bin
>Synopsis:       nos-tun(8) WARNS=3 cleanup
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 28 19:30:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Ulrich Spörlein
>Release:        FreeBSD 9.0-CURRENT i386
>Organization:
>Environment:
	
>Description:
- Fixes more or less compatible to the DragonflyBSD work
- Code would be WARNS=6 clean, if it wasn't for increased alignment warnings

	
>How-To-Repeat:
	
>Fix:

	

--- nostun.diff begins here ---
diff -r 6770add1b4ad -r 4e35b87f9d20 sbin/nos-tun/Makefile
--- a/sbin/nos-tun/Makefile	Wed Oct 28 20:11:13 2009 +0100
+++ b/sbin/nos-tun/Makefile	Wed Oct 28 20:19:29 2009 +0100
@@ -1,8 +1,8 @@
 # $FreeBSD$
 
 PROG=	nos-tun
-WARNS?=	0
 MAN=	nos-tun.8
+WARNS?=	3
 
 .include <bsd.prog.mk>
 
diff -r 6770add1b4ad -r 4e35b87f9d20 sbin/nos-tun/nos-tun.c
--- a/sbin/nos-tun/nos-tun.c	Wed Oct 28 20:11:13 2009 +0100
+++ b/sbin/nos-tun/nos-tun.c	Wed Oct 28 20:19:29 2009 +0100
@@ -89,7 +89,8 @@
 
 static void usage(void);
 
-int Set_address(char *addr, struct sockaddr_in *sin)
+static int
+Set_address(char *addr, struct sockaddr_in *sin)
 {
   struct hostent *hp;
 
@@ -107,15 +108,16 @@
   return 0;
 }
 
-int tun_open(char *devname, struct sockaddr *ouraddr, char *theiraddr)
+static int
+tun_open(char *dev_name, struct sockaddr *ouraddr, char *theiraddr)
 {
   int s;
   struct sockaddr_in *sin;
 
   /* Open tun device */
-  tun = open (devname, O_RDWR);
+  tun = open (dev_name, O_RDWR);
   if (tun < 0) {
-    syslog(LOG_ERR,"can't open %s - %m",devname);
+    syslog(LOG_ERR,"can't open %s - %m",dev_name);
     return(1);
   }
 
@@ -125,8 +127,8 @@
   bzero((char *)&ifra, sizeof(ifra));
   bzero((char *)&ifrq, sizeof(ifrq));
 
-  strncpy(ifrq.ifr_name, devname+5, IFNAMSIZ);
-  strncpy(ifra.ifra_name, devname+5, IFNAMSIZ);
+  strncpy(ifrq.ifr_name, dev_name+5, IFNAMSIZ);
+  strncpy(ifra.ifra_name, dev_name+5, IFNAMSIZ);
 
   s = socket(AF_INET, SOCK_DGRAM, 0);
   if (s < 0) {
@@ -189,7 +191,8 @@
   return(1);
 }
 
-void Finish(int signum)
+static void
+Finish(int signum)
 {
   int s;
 
@@ -238,7 +241,7 @@
 {
   int  c, len, ipoff;
 
-  char *devname = NULL;
+  char *dev_name = NULL;
   char *point_to = NULL;
   char *to_point = NULL;
   char *target;
@@ -268,7 +271,7 @@
       point_to = optarg;
       break;
     case 't':
-      devname = optarg;
+      dev_name = optarg;
       break;
     case 'p':
       protocol = optarg;
@@ -278,7 +281,7 @@
   argc -= optind;
   argv += optind;
 
-  if ((argc != 1 && argc != 2) || (devname == NULL) ||
+  if ((argc != 1 && argc != 2) || (dev_name == NULL) ||
       (point_to == NULL) || (to_point == NULL)) {
     usage();
   }
@@ -302,7 +305,7 @@
     exit(2);
   }
 
-  if(tun_open(devname, &t_laddr, to_point)) {
+  if(tun_open(dev_name, &t_laddr, to_point)) {
     closelog();
     exit(3);
   }
--- nostun.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910281921.n9SJLrhG004496>