aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTelemaque Ndizihiwe <telendiz@eircom.net>2005-06-23 03:10:33 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 12:45:36 -0400
commitfed2fc18a4567d613cd35115322257c6c6c710e9 (patch)
tree937d8584966661b72cd7f71a6a6e4f0b97350760
parent64ccd715d3cf498318b14b646ce5f97e7ab15bb5 (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>
-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