[radvd-devel-l] Anything for the next release?

Jim Paris jim at jtan.com
Tue Oct 14 13:58:15 EDT 2008


Hi,

Anonymous radvd CVS appears broken:

$ cvs -d :pserver:anonymous at cvs.litech.org:/work/cvsroot checkout radvd
cvs [checkout aborted]: could not get working directory: Permission denied


> If someone is looking for a spare time project, looking into the 
> -Wconversion warnings might be useful.  I looked at a few and saw a 
> couple that could be an issue, and a lot which aren't but I couldn't 
> find a nice way to silence them.

-Wconversion results in some unsilencable warnings when the code is
actually fine, at least on gcc 4.2.  gcc 4.3 seems better, although
there are still problems that are maybe fixed in gcc 4.4:
  http://www.nabble.com/gcc-4.3.0,--Wconversion-against--O1-td19574104.html

Anyway, I think it's a good idea to remove -Wconversion for now.
Below is a patch to fix some of the complaints, though.  Printing
pid_t as %ld instead of %d might matter on some (rare) systems;
the other fixes aren't too important.

-jim

diff -pur radvd-1.2rc1/radvd.c radvd-1.2rc1-jim/radvd.c
--- radvd-1.2rc1/radvd.c	2008-10-14 07:37:32.000000000 -0400
+++ radvd-1.2rc1-jim/radvd.c	2008-10-14 13:48:22.000000000 -0400
@@ -70,7 +70,7 @@ main(int argc, char *argv[])
 {
 	unsigned char msg[MSG_SIZE];
 	char pidstr[16];
-	int ret;
+	ssize_t ret;
 	int c, log_method;
 	char *logfile, *pidfile;
 	sigset_t oset, nset;
@@ -240,7 +240,7 @@ main(int argc, char *argv[])
 			exit(1);
 		}
 		pidstr[ret] = '\0';
-		if (!kill(atol(pidstr), 0))
+		if (!kill((pid_t)atol(pidstr), 0))
 		{
 			flog(LOG_ERR, "radvd already running, terminating.");
 			exit(1);
@@ -293,7 +293,7 @@ main(int argc, char *argv[])
 	signal(SIGTERM, sigterm_handler);
 	signal(SIGINT, sigint_handler);
 
-	snprintf(pidstr, sizeof(pidstr), "%d\n", getpid());
+	snprintf(pidstr, sizeof(pidstr), "%ld\n", (long)getpid());
 	
 	write(fd, pidstr, strlen(pidstr));
 	
diff -pur radvd-1.2rc1/send.c radvd-1.2rc1-jim/send.c
--- radvd-1.2rc1/send.c	2006-10-09 02:21:59.000000000 -0400
+++ radvd-1.2rc1-jim/send.c	2008-10-14 13:49:03.000000000 -0400
@@ -36,8 +36,8 @@ send_ra(int sock, struct Interface *ifac
 	   do that with e.g., too many advertised prefixes or routes, but buff is just so
 	   large that this should never happen and if it does, it's admin's fault :-)  */
 	unsigned char buff[MSG_SIZE];
-	int len = 0;
-	int err;
+	size_t len = 0;
+	ssize_t err;
 
 	/* First we need to check that the interface hasn't been removed or deactivated */
 	if(check_device(sock, iface) < 0) {
diff -pur radvd-1.2rc1/util.c radvd-1.2rc1-jim/util.c
--- radvd-1.2rc1/util.c	2008-01-24 05:03:17.000000000 -0500
+++ radvd-1.2rc1-jim/util.c	2008-10-14 13:14:15.000000000 -0400
@@ -99,7 +99,7 @@ writen(int fd, const void *buf, size_t c
 		}
 		if (r == 0)
 			return n;
-		buf = (char *)buf + r;
+		buf = (const char *)buf + r;
 		count -= r;
 		n += r;
 	}



More information about the radvd-devel-l mailing list