Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Sep 2007 05:17:47 GMT
From:      Josh Carroll <josh.carroll@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/116757: ushare is broken for amd64
Message-ID:  <200709300517.l8U5HloV008249@www.freebsd.org>
Resent-Message-ID: <200709300520.l8U5K1DJ043297@freefall.freebsd.org>

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

>Number:         116757
>Category:       ports
>Synopsis:       ushare is broken for amd64
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 30 05:20:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Josh Carroll
>Release:        6.2-RELEASE-p7 amd64
>Organization:
n/a
>Environment:
FreeBSD pflog.net 6.2-RELEASE-p7 FreeBSD 6.2-RELEASE-p7 #0: Sat Sep 29 14:50:41 EDT 2007     root@pflog.net:/usr/obj/usr/src/sys/PFLOG64  amd64

>Description:
The ushare port has a bug in the code that prevents it from working properly on an amd64 installation of 6.2-RELEASE.

When ushare is run, it fails with:

pflog# /usr/local/etc/rc.d/ushare start
Starting ushare.
sysctl: No such file or directory

I tracked this down to the sysctl calls in ushare.c, which are passing &len with len defined as an int. In fact, the compiler generates warnings for these:

ushare.c: In function `create_udn':
ushare.c:413: warning: passing arg 4 of `sysctl' from incompatible pointer type
ushare.c:420: warning: passing arg 4 of `sysctl' from incompatible pointer type

len should be of type size_t, not int. Defining len as size_t fixes the problem.

Thanks,
Josh
>How-To-Repeat:
cd /usr/ports/net/ushare
make && make install
/usr/local/etc/rc.d/ushare forcestart
>Fix:
Attached is a patch which changes the type of len from int to size_t in the create_udn function.

Patch attached with submission follows:

--- src/ushare.c.old	Sun Sep 30 01:03:37 2007
+++ src/ushare.c	Sun Sep 30 01:03:57 2007
@@ -386,7 +386,8 @@
   unsigned char *ptr;
 
 #if (defined(BSD) || defined(__FreeBSD__))
-  int mib[6], len;
+  int mib[6];
+  size_t len;
   struct if_msghdr *ifm;
   struct sockaddr_dl *sdl;
 #else /* Linux */


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



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