diff options
author | Telemaque Ndizihiwe <telendiz@eircom.net> | 2005-06-23 03:10:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 12:45:36 -0400 |
commit | fed2fc18a4567d613cd35115322257c6c6c710e9 (patch) | |
tree | 937d8584966661b72cd7f71a6a6e4f0b97350760 /fs/open.c | |
parent | 64ccd715d3cf498318b14b646ce5f97e7ab15bb5 (diff) |
[PATCH] sys_open() cleanup
Clean up tortured logic in sys_open().
Signed-off-by: Telemaque Ndizihiwe <telendiz@eircom.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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 | ||