diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-01-24 18:04:22 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-22 23:31:34 -0500 |
commit | 5f4a6a695075b79261793c25b1128e3b30007646 (patch) | |
tree | 6f304f5b1a84bb1face5428f6d55160453583e6c | |
parent | ad8ca3743cb7eef0eb8a2e87943c513201685eec (diff) |
link_path_walk(): move assignments to nd->last/nd->last_type up
... and clean the main loop a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namei.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/namei.c b/fs/namei.c index e0a33f598cdf..14eab848f7d8 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1802,8 +1802,11 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1802 | } | 1802 | } |
1803 | } | 1803 | } |
1804 | 1804 | ||
1805 | nd->last = this; | ||
1806 | nd->last_type = type; | ||
1807 | |||
1805 | if (!name[len]) | 1808 | if (!name[len]) |
1806 | goto last_component; | 1809 | return 0; |
1807 | /* | 1810 | /* |
1808 | * If it wasn't NUL, we know it was '/'. Skip that | 1811 | * If it wasn't NUL, we know it was '/'. Skip that |
1809 | * slash, and continue until no more slashes. | 1812 | * slash, and continue until no more slashes. |
@@ -1812,7 +1815,8 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1812 | len++; | 1815 | len++; |
1813 | } while (unlikely(name[len] == '/')); | 1816 | } while (unlikely(name[len] == '/')); |
1814 | if (!name[len]) | 1817 | if (!name[len]) |
1815 | goto last_component; | 1818 | return 0; |
1819 | |||
1816 | name += len; | 1820 | name += len; |
1817 | 1821 | ||
1818 | err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW); | 1822 | err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW); |
@@ -1824,16 +1828,10 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1824 | if (err) | 1828 | if (err) |
1825 | return err; | 1829 | return err; |
1826 | } | 1830 | } |
1827 | if (can_lookup(nd->inode)) | 1831 | if (!can_lookup(nd->inode)) { |
1828 | continue; | 1832 | err = -ENOTDIR; |
1829 | err = -ENOTDIR; | 1833 | break; |
1830 | break; | 1834 | } |
1831 | /* here ends the main loop */ | ||
1832 | |||
1833 | last_component: | ||
1834 | nd->last = this; | ||
1835 | nd->last_type = type; | ||
1836 | return 0; | ||
1837 | } | 1835 | } |
1838 | terminate_walk(nd); | 1836 | terminate_walk(nd); |
1839 | return err; | 1837 | return err; |