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

Commit fed2fc18 authored by Telemaque Ndizihiwe's avatar Telemaque Ndizihiwe Committed by Linus Torvalds
Browse files

[PATCH] sys_open() cleanup



Clean up tortured logic in sys_open().

Signed-off-by: default avatarTelemaque Ndizihiwe <telendiz@eircom.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 64ccd715
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -934,7 +934,7 @@ EXPORT_SYMBOL(fd_install);
asmlinkage long sys_open(const char __user * filename, int flags, int mode)
{
	char * tmp;
	int fd, error;
	int fd;

	if (force_o_largefile())
		flags |= O_LARGEFILE;
@@ -945,20 +945,16 @@ asmlinkage long sys_open(const char __user * filename, int flags, int mode)
		fd = get_unused_fd();
		if (fd >= 0) {
			struct file *f = filp_open(tmp, flags, mode);
			error = PTR_ERR(f);
			if (IS_ERR(f))
				goto out_error;
			if (IS_ERR(f)) {
				put_unused_fd(fd);
				fd = PTR_ERR(f);
			} else {
				fd_install(fd, f);
			}
out:
		}
		putname(tmp);
	}
	return fd;

out_error:
	put_unused_fd(fd);
	fd = error;
	goto out;
}
EXPORT_SYMBOL_GPL(sys_open);