Subject: Re: bin/37549: ssshfs in netbsd-4 creates wrong symlinks
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: dieter roelants <dieter.NetBSD@pandora.be>
List: netbsd-bugs
Date: 12/16/2007 21:35:03
The following reply was made to PR bin/37549; it has been noted by GNATS.

From: dieter roelants <dieter.NetBSD@pandora.be>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/37549: ssshfs in netbsd-4 creates wrong symlinks
Date: Sun, 16 Dec 2007 22:29:29 +0100

 On Sun, 16 Dec 2007 20:20:02 +0000 (UTC)
 Antti Kantee <pooka@cs.hut.fi> wrote:
 
 >  Just __UNCONST() it.
 
 Right, thanks. There you go:
 
 Index: ssshfs.c
 ===================================================================
 RCS file: /cvsroot/src/share/examples/puffs/ssshfs/Attic/ssshfs.c,v
 retrieving revision 1.9
 diff -u -r1.9 ssshfs.c
 --- ssshfs.c	1 Dec 2006 12:50:52 -0000	1.9
 +++ ssshfs.c	16 Dec 2007 21:26:19 -0000
 @@ -34,6 +34,7 @@
   * (sante sshfs?  severed (dreams) sshfs?  saucy sshfs?  sauerkraut sshfs?)
   */
  
 +#include <sys/cdefs.h>
  #include <sys/types.h>
  
  #include <assert.h>
 @@ -578,18 +579,10 @@
  	if (sftp_proto_version(sftpc) < 3)
  		return EOPNOTSUPP;
  
 -	if (*link_target == '/') {
 -		strcpy(buf, link_target);
 -	} else {
 -		strcpy(buf, ssd->name);
 -		strcat(buf, "/");
 -		strcat(buf, link_target);
 -	}
 -
  	newssn = makenewnode(ssd, pcn->pcn_name, NULL);
  	puffs_setvattr(&newssn->va, va);
  	a = vattrtoAttrib(va);
 -	if ((rv = do_symlink(sftpc, newssn->name, buf)) != 0)
 +	if ((rv = do_symlink(sftpc, __UNCONST(link_target), newssn->name)) != 0)
  		return EIO;
  
  	ssd->dcache |= DCACHE_CHANGED;
 
 
 dieter