提交 fed2fc18 编写于 作者: T Telemaque Ndizihiwe 提交者: Linus Torvalds

[PATCH] sys_open() cleanup

Clean up tortured logic in sys_open().
Signed-off-by: NTelemaque Ndizihiwe <telendiz@eircom.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 64ccd715
...@@ -934,7 +934,7 @@ EXPORT_SYMBOL(fd_install); ...@@ -934,7 +934,7 @@ EXPORT_SYMBOL(fd_install);
asmlinkage long sys_open(const char __user * filename, int flags, int mode) asmlinkage long sys_open(const char __user * filename, int flags, int mode)
{ {
char * tmp; char * tmp;
int fd, error; int fd;
if (force_o_largefile()) if (force_o_largefile())
flags |= O_LARGEFILE; flags |= O_LARGEFILE;
...@@ -945,20 +945,16 @@ asmlinkage long sys_open(const char __user * filename, int flags, int mode) ...@@ -945,20 +945,16 @@ asmlinkage long sys_open(const char __user * filename, int flags, int mode)
fd = get_unused_fd(); fd = get_unused_fd();
if (fd >= 0) { if (fd >= 0) {
struct file *f = filp_open(tmp, flags, mode); struct file *f = filp_open(tmp, flags, mode);
error = PTR_ERR(f); if (IS_ERR(f)) {
if (IS_ERR(f)) put_unused_fd(fd);
goto out_error; fd = PTR_ERR(f);
fd_install(fd, f); } else {
fd_install(fd, f);
}
} }
out:
putname(tmp); putname(tmp);
} }
return fd; return fd;
out_error:
put_unused_fd(fd);
fd = error;
goto out;
} }
EXPORT_SYMBOL_GPL(sys_open); EXPORT_SYMBOL_GPL(sys_open);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册