aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/open.c b/fs/open.c
index 5dd411b084bf..8ec63f735918 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -934,7 +934,7 @@ EXPORT_SYMBOL(fd_install);
934asmlinkage long sys_open(const char __user * filename, int flags, int mode) 934asmlinkage long sys_open(const char __user * filename, int flags, int mode)
935{ 935{
936 char * tmp; 936 char * tmp;
937 int fd, error; 937 int fd;
938 938
939 if (force_o_largefile()) 939 if (force_o_largefile())
940 flags |= O_LARGEFILE; 940 flags |= O_LARGEFILE;
@@ -945,20 +945,16 @@ asmlinkage long sys_open(const char __user * filename, int flags, int mode)
945 fd = get_unused_fd(); 945 fd = get_unused_fd();
946 if (fd >= 0) { 946 if (fd >= 0) {
947 struct file *f = filp_open(tmp, flags, mode); 947 struct file *f = filp_open(tmp, flags, mode);
948 error = PTR_ERR(f); 948 if (IS_ERR(f)) {
949 if (IS_ERR(f)) 949 put_unused_fd(fd);
950 goto out_error; 950 fd = PTR_ERR(f);
951 fd_install(fd, f); 951 } else {
952 fd_install(fd, f);
953 }
952 } 954 }
953out:
954 putname(tmp); 955 putname(tmp);
955 } 956 }
956 return fd; 957 return fd;
957
958out_error:
959 put_unused_fd(fd);
960 fd = error;
961 goto out;
962} 958}
963EXPORT_SYMBOL_GPL(sys_open); 959EXPORT_SYMBOL_GPL(sys_open);
964 960