From owner-freebsd-current Sun Jun 17 18:50:20 2001 Delivered-To: freebsd-current@freebsd.org Received: from earth.backplane.com (earth-nat-cw.backplane.com [208.161.114.67]) by hub.freebsd.org (Postfix) with ESMTP id B82A337B405 for ; Sun, 17 Jun 2001 18:49:57 -0700 (PDT) (envelope-from dillon@earth.backplane.com) Received: (from dillon@localhost) by earth.backplane.com (8.11.3/8.11.2) id f5I1nma09752; Sun, 17 Jun 2001 18:49:48 -0700 (PDT) (envelope-from dillon) Date: Sun, 17 Jun 2001 18:49:48 -0700 (PDT) From: Matt Dillon Message-Id: <200106180149.f5I1nma09752@earth.backplane.com> To: "Andrey A. Chernov" Cc: Garance A Drosihn , Jordan Hubbard , bde@zeta.org.au, imp@harmony.village.org, steveo@eircom.net, david@catwhisker.org, current@FreeBSD.ORG Subject: Ok, try this patch. (was Re: symlink(2) [Was: Re: tcsh.cat]) References: <200106170518.f5H5I6V44586@harmony.village.org> <20010617113141A.jkh@osd.bsdi.com> <20010617231418.A60728@nagual.pp.ru> <200106172128.f5HLSe108208@earth.backplane.com> <20010618053251.B58432@nagual.pp.ru> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG : :On Sun, Jun 17, 2001 at 21:16:24 -0400, Garance A Drosihn wrote: :> :> When I say this, I assume that the only change to make is how any :> 'open' or 'stat' call will handle null symlinks. If I am reading :> Andrey correctly, there will be no change to the 'ln' command or :> the symlink() system routine. : :Yes. : :> I generally prefer returning an error at the earliest point it can be :> determined to be an error, and thus I think it IS worth it to make :> this an error at open() or stat() time. I see no benefit in letting :> those succeed only to have some strange error occur in later processing. : :Yes. : :-- :Andrey A. Chernov Ok, this patch should do it. For review. I've made it return ENOENT, which is the same error that is returned when you try to open an empty path (e.g. open("", ...)). (Note: This is unrelated to Bruce's second issue with 'cp' copying symlinks that don't exist, which is a cp-specific). If nobody has any objections I will commit this to -current on wednesday and MFC it next saturday. -Matt Index: vfs_lookup.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_lookup.c,v retrieving revision 1.38.2.2 diff -u -r1.38.2.2 vfs_lookup.c --- vfs_lookup.c 2001/05/20 12:11:57 1.38.2.2 +++ vfs_lookup.c 2001/06/18 01:39:46 @@ -200,6 +200,12 @@ break; } linklen = MAXPATHLEN - auio.uio_resid; + if (linklen == 0) { + if (ndp->ni_pathlen > 1) + zfree(namei_zone, cp); + error = ENOENT; + break; + } if (linklen + ndp->ni_pathlen >= MAXPATHLEN) { if (ndp->ni_pathlen > 1) zfree(namei_zone, cp); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message