Commit 9e67f36169117e07daf16dc7ca314f1db9e2050a
1 parent
67ee3ad21d
Exists in
master
and in
4 other branches
Kill is_link argument of do_last()
We set it to 1 iff we return NULL Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 7 additions and 14 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -1647,15 +1647,12 @@ |
1647 | 1647 | |
1648 | 1648 | static struct file *do_last(struct nameidata *nd, struct path *path, |
1649 | 1649 | int open_flag, int acc_mode, |
1650 | - int mode, const char *pathname, | |
1651 | - int *is_link) | |
1650 | + int mode, const char *pathname) | |
1652 | 1651 | { |
1653 | 1652 | struct dentry *dir = nd->path.dentry; |
1654 | 1653 | struct file *filp; |
1655 | 1654 | int error; |
1656 | 1655 | |
1657 | - *is_link = 0; | |
1658 | - | |
1659 | 1656 | if (nd->last_type == LAST_BIND) |
1660 | 1657 | goto ok; |
1661 | 1658 | |
1662 | 1659 | |
... | ... | @@ -1727,10 +1724,9 @@ |
1727 | 1724 | error = -ENOENT; |
1728 | 1725 | if (!path->dentry->d_inode) |
1729 | 1726 | goto exit_dput; |
1730 | - if (path->dentry->d_inode->i_op->follow_link) { | |
1731 | - *is_link = 1; | |
1727 | + | |
1728 | + if (path->dentry->d_inode->i_op->follow_link) | |
1732 | 1729 | return NULL; |
1733 | - } | |
1734 | 1730 | |
1735 | 1731 | path_to_nameidata(path, nd); |
1736 | 1732 | error = -EISDIR; |
... | ... | @@ -1766,7 +1762,6 @@ |
1766 | 1762 | int count = 0; |
1767 | 1763 | int flag = open_to_namei_flags(open_flag); |
1768 | 1764 | int force_reval = 0; |
1769 | - int is_link; | |
1770 | 1765 | |
1771 | 1766 | /* |
1772 | 1767 | * O_SYNC is implemented as __O_SYNC|O_DSYNC. As many places only |
... | ... | @@ -1849,9 +1844,8 @@ |
1849 | 1844 | nd.flags |= LOOKUP_CREATE | LOOKUP_OPEN; |
1850 | 1845 | if (open_flag & O_EXCL) |
1851 | 1846 | nd.flags |= LOOKUP_EXCL; |
1852 | - filp = do_last(&nd, &path, open_flag, acc_mode, mode, | |
1853 | - pathname, &is_link); | |
1854 | - if (is_link) | |
1847 | + filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); | |
1848 | + if (!filp) | |
1855 | 1849 | goto do_link; |
1856 | 1850 | if (nd.root.mnt) |
1857 | 1851 | path_put(&nd.root); |
1858 | 1852 | |
... | ... | @@ -1902,11 +1896,10 @@ |
1902 | 1896 | return ERR_PTR(error); |
1903 | 1897 | } |
1904 | 1898 | nd.flags &= ~LOOKUP_PARENT; |
1905 | - filp = do_last(&nd, &path, open_flag, acc_mode, mode, | |
1906 | - pathname, &is_link); | |
1899 | + filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); | |
1907 | 1900 | if (nd.last_type == LAST_NORM) |
1908 | 1901 | __putname(nd.last.name); |
1909 | - if (is_link) | |
1902 | + if (!filp) | |
1910 | 1903 | goto do_link; |
1911 | 1904 | if (nd.root.mnt) |
1912 | 1905 | path_put(&nd.root); |