Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e67f361 authored by Al Viro's avatar Al Viro
Browse files

Kill is_link argument of do_last()



We set it to 1 iff we return NULL

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 67ee3ad2
Loading
Loading
Loading
Loading
+7 −14
Original line number Original line Diff line number Diff line
@@ -1647,15 +1647,12 @@ exit:


static struct file *do_last(struct nameidata *nd, struct path *path,
static struct file *do_last(struct nameidata *nd, struct path *path,
			    int open_flag, int acc_mode,
			    int open_flag, int acc_mode,
			    int mode, const char *pathname,
			    int mode, const char *pathname)
			    int *is_link)
{
{
	struct dentry *dir = nd->path.dentry;
	struct dentry *dir = nd->path.dentry;
	struct file *filp;
	struct file *filp;
	int error;
	int error;


	*is_link = 0;

	if (nd->last_type == LAST_BIND)
	if (nd->last_type == LAST_BIND)
		goto ok;
		goto ok;


@@ -1727,10 +1724,9 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
	error = -ENOENT;
	error = -ENOENT;
	if (!path->dentry->d_inode)
	if (!path->dentry->d_inode)
		goto exit_dput;
		goto exit_dput;
	if (path->dentry->d_inode->i_op->follow_link) {

		*is_link = 1;
	if (path->dentry->d_inode->i_op->follow_link)
		return NULL;
		return NULL;
	}


	path_to_nameidata(path, nd);
	path_to_nameidata(path, nd);
	error = -EISDIR;
	error = -EISDIR;
@@ -1766,7 +1762,6 @@ struct file *do_filp_open(int dfd, const char *pathname,
	int count = 0;
	int count = 0;
	int flag = open_to_namei_flags(open_flag);
	int flag = open_to_namei_flags(open_flag);
	int force_reval = 0;
	int force_reval = 0;
	int is_link;


	/*
	/*
	 * O_SYNC is implemented as __O_SYNC|O_DSYNC.  As many places only
	 * O_SYNC is implemented as __O_SYNC|O_DSYNC.  As many places only
@@ -1849,9 +1844,8 @@ reval:
	nd.flags |= LOOKUP_CREATE | LOOKUP_OPEN;
	nd.flags |= LOOKUP_CREATE | LOOKUP_OPEN;
	if (open_flag & O_EXCL)
	if (open_flag & O_EXCL)
		nd.flags |= LOOKUP_EXCL;
		nd.flags |= LOOKUP_EXCL;
	filp = do_last(&nd, &path, open_flag, acc_mode, mode,
	filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
		       pathname, &is_link);
	if (!filp)
	if (is_link)
		goto do_link;
		goto do_link;
	if (nd.root.mnt)
	if (nd.root.mnt)
		path_put(&nd.root);
		path_put(&nd.root);
@@ -1902,11 +1896,10 @@ do_link:
		return ERR_PTR(error);
		return ERR_PTR(error);
	}
	}
	nd.flags &= ~LOOKUP_PARENT;
	nd.flags &= ~LOOKUP_PARENT;
	filp = do_last(&nd, &path, open_flag, acc_mode, mode,
	filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
		       pathname, &is_link);
	if (nd.last_type == LAST_NORM)
	if (nd.last_type == LAST_NORM)
		__putname(nd.last.name);
		__putname(nd.last.name);
	if (is_link)
	if (!filp)
		goto do_link;
		goto do_link;
	if (nd.root.mnt)
	if (nd.root.mnt)
		path_put(&nd.root);
		path_put(&nd.root);