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


Index: vfs_lookup.c
RCS file: /home/ncvs/src/sys/kern/vfs_lookup.c,v
retrieving revision
diff -u -r1.38.2.2 vfs_lookup.c
--- vfs_lookup.c        2001/05/20 12:11:57
+++ vfs_lookup.c        2001/06/18 01:39:46
@@ -200,6 +200,12 @@
                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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to