Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jun 2001 18:49:48 -0700 (PDT)
From:      Matt Dillon <dillon@earth.backplane.com>
To:        "Andrey A. Chernov" <ache@nagual.pp.ru>
Cc:        Garance A Drosihn <drosih@rpi.edu>, Jordan Hubbard <jkh@osd.bsdi.com>, 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])
Message-ID:  <200106180149.f5I1nma09752@earth.backplane.com>
References:  <200106170518.f5H5I6V44586@harmony.village.org> <Pine.BSF.4.21.0106172154520.582-100000@besplex.bde.org> <20010617113141A.jkh@osd.bsdi.com> <20010617231418.A60728@nagual.pp.ru> <200106172128.f5HLSe108208@earth.backplane.com> <p05100e0eb753048b371c@[128.113.24.47]> <20010618053251.B58432@nagual.pp.ru>

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

:
: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




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