Subject: Re: bin/37549: ssshfs in netbsd-4 creates wrong symlinks
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: Antti Kantee <pooka@cs.hut.fi>
List: netbsd-bugs
Date: 12/16/2007 19:10:08
The following reply was made to PR bin/37549; it has been noted by GNATS.
From: Antti Kantee <pooka@cs.hut.fi>
To: dieter.NetBSD@pandora.be
Cc: gnats-bugs@NetBSD.org
Subject: Re: bin/37549: ssshfs in netbsd-4 creates wrong symlinks
Date: Sun, 16 Dec 2007 21:05:46 +0200
On Sun Dec 16 2007 at 12:25:00 +0000, dieter.NetBSD@pandora.be wrote:
> >Fix:
> 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 12:16:10 -0000
> @@ -578,18 +578,12 @@
> 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);
> - }
> + strcpy(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, buf, newssn->name)) != 0)
> return EIO;
>
> ssd->dcache |= DCACHE_CHANGED;
>
The strcpy() is unnecessary. Otherwise this patch is good. Can you
test & submit one which just uses link_target directly?
--
Antti Kantee <pooka@iki.fi> Of course he runs NetBSD
http://www.iki.fi/pooka/ http://www.NetBSD.org/
"la qualité la plus indispensable du cuisinier est l'exactitude"