How's this?

Index: sys/kern/vfs_lookup.c
===================================================================
--- sys/kern/vfs_lookup.c       (revision 193028)
+++ sys/kern/vfs_lookup.c       (working copy)
@@ -454,7 +454,6 @@
        int docache;                    /* == 0 do not cache last component */
        int wantparent;                 /* 1 => wantparent or lockparent flag */
        int rdonly;                     /* lookup read-only flag bit */
-       int trailing_slash;
        int error = 0;
        int dpunlocked = 0;             /* dp has already been unlocked */
        struct componentname *cnp = &ndp->ni_cnd;
@@ -529,12 +528,10 @@
         * trailing slashes to handle symlinks, existing non-directories
         * and non-existing files that won't be directories specially later.
         */
-       trailing_slash = 0;
        while (*cp == '/' && (cp[1] == '/' || cp[1] == '\0')) {
                cp++;
                ndp->ni_pathlen--;
                if (*cp == '\0') {
-                       trailing_slash = 1;
                        *ndp->ni_next = '\0';   /* XXX for direnter() ... */
                        cnp->cn_flags |= TRAILINGSLASH;
                }
@@ -711,7 +708,7 @@
                        error = EROFS;
                        goto bad;
                }
-               if (*cp == '\0' && trailing_slash &&
+               if (*cp == '\0' && (cnp->cn_flags & TRAILINGSLASH) &&
                     !(cnp->cn_flags & WILLBEDIR)) {
                        error = ENOENT;
                        goto bad;
@@ -788,7 +785,7 @@
         * Check for symbolic link
         */
        if ((dp->v_type == VLNK) &&
-           ((cnp->cn_flags & FOLLOW) || trailing_slash ||
+           ((cnp->cn_flags & FOLLOW) || (cnp->cn_flags & TRAILINGSLASH) ||
             *ndp->ni_next == '/')) {
                cnp->cn_flags |= ISSYMLINK;
                if (dp->v_iflag & VI_DOOMED) {

BTW, what does the "XXX for direnter()" comment mean?

DES
-- 
Dag-Erling Smørgrav - d...@des.no
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to