patch-2.1.128 linux/fs/open.c

Next file: linux/fs/proc/array.c
Previous file: linux/fs/nfs/write.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.127/linux/fs/open.c linux/fs/open.c
@@ -626,7 +626,7 @@
  * for the internal routines (ie open_namei()/follow_link() etc). 00 is
  * used by symlinks.
  */
-static int do_open(const char * filename, int flags, int mode, int fd)
+struct file *filp_open(const char * filename, int flags, int mode)
 {
 	struct inode * inode;
 	struct dentry * dentry;
@@ -667,8 +667,7 @@
 	}
 	f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
 
-	fd_install(fd, f);
-	return 0;
+	return f;
 
 cleanup_all:
 	if (f->f_mode & FMODE_WRITE)
@@ -679,7 +678,19 @@
 cleanup_file:
 	put_filp(f);
 out:
-	return error;
+	return ERR_PTR(error);
+}
+
+/* should probably go into sys_open() */
+static int do_open(const char * filename, int flags, int mode, int fd)
+{
+	struct file * f;
+
+	f = filp_open(filename, flags, mode);
+	if (IS_ERR(f))
+		return PTR_ERR(f);
+	fd_install(fd, f);
+	return 0;
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov