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/17/2007 09:00:07
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: Mon, 17 Dec 2007 09:55:42 +0100
On Sun, 16 Dec 2007 22:15:06 +0000 (UTC)
Antti Kantee <pooka@cs.hut.fi> wrote:
> Thanks. But one more thing: kill the "buf" local variable.
d'oh!
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 17 Dec 2007 08:54:43 -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>
@@ -571,25 +572,16 @@
const char *link_target)
{
struct ssshnode *ssd = opc, *newssn;
- char buf[MAXPATHLEN+1];
Attrib *a;
int rv;
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