diff options
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -934,7 +934,7 @@ EXPORT_SYMBOL(fd_install); | |||
934 | asmlinkage long sys_open(const char __user * filename, int flags, int mode) | 934 | asmlinkage 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 | } |
953 | out: | ||
954 | putname(tmp); | 955 | putname(tmp); |
955 | } | 956 | } |
956 | return fd; | 957 | return fd; |
957 | |||
958 | out_error: | ||
959 | put_unused_fd(fd); | ||
960 | fd = error; | ||
961 | goto out; | ||
962 | } | 958 | } |
963 | EXPORT_SYMBOL_GPL(sys_open); | 959 | EXPORT_SYMBOL_GPL(sys_open); |
964 | 960 | ||