]> Pileus Git - ~andy/linux/commitdiff
link_path_walk(): move assignments to nd->last/nd->last_type up
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 24 Jan 2013 23:04:22 +0000 (18:04 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 23 Feb 2013 04:31:34 +0000 (23:31 -0500)
... and clean the main loop a bit

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index e0a33f598cdf18e651d29d82939f6243bef38036..14eab848f7d8aa33024ed98d4fe3f8d854dd97f5 100644 (file)
@@ -1802,8 +1802,11 @@ static int link_path_walk(const char *name, struct nameidata *nd)
                        }
                }
 
+               nd->last = this;
+               nd->last_type = type;
+
                if (!name[len])
-                       goto last_component;
+                       return 0;
                /*
                 * If it wasn't NUL, we know it was '/'. Skip that
                 * slash, and continue until no more slashes.
@@ -1812,7 +1815,8 @@ static int link_path_walk(const char *name, struct nameidata *nd)
                        len++;
                } while (unlikely(name[len] == '/'));
                if (!name[len])
-                       goto last_component;
+                       return 0;
+
                name += len;
 
                err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW);
@@ -1824,16 +1828,10 @@ static int link_path_walk(const char *name, struct nameidata *nd)
                        if (err)
                                return err;
                }
-               if (can_lookup(nd->inode))
-                       continue;
-               err = -ENOTDIR; 
-               break;
-               /* here ends the main loop */
-
-last_component:
-               nd->last = this;
-               nd->last_type = type;
-               return 0;
+               if (!can_lookup(nd->inode)) {
+                       err = -ENOTDIR; 
+                       break;
+               }
        }
        terminate_walk(nd);
        return err;