diff -urpNX dontdiff linux-2.5.38/arch/ppc64/kernel/sys_ppc32.c linux-2.5.38-willy/arch/ppc64/kernel/sys_ppc32.c
--- linux-2.5.38/arch/ppc64/kernel/sys_ppc32.c 2002-09-23 10:20:27.000000000 -0400
+++ linux-2.5.38-willy/arch/ppc64/kernel/sys_ppc32.c 2002-09-27 09:48:18.000000000 -0400
@@ -3889,21 +3889,18 @@ long sys32_open(const char * filename, i
if (!IS_ERR(tmp)) {
fd = get_unused_fd();
if (fd >= 0) {
- struct file * f = filp_open(tmp, flags, mode);
+ struct file * f = filp_open(tmp, flags | O_PUTNAME, mode);
error = PTR_ERR(f);
if (IS_ERR(f))
goto out_error;
fd_install(fd, f);
}
-out:
- putname(tmp);
}
return fd;
out_error:
put_unused_fd(fd);
- fd = error;
- goto out;
+ return error;
}
extern asmlinkage long sys_readlink(const char * path, char * buf, int bufsiz);
diff -urpNX dontdiff linux-2.5.38/arch/sparc64/kernel/sys_sparc32.c linux-2.5.38-willy/arch/sparc64/kernel/sys_sparc32.c
--- linux-2.5.38/arch/sparc64/kernel/sys_sparc32.c 2002-09-16 14:46:59.000000000 -0400
+++ linux-2.5.38-willy/arch/sparc64/kernel/sys_sparc32.c 2002-09-27 09:47:23.000000000 -0400
@@ -4061,21 +4061,18 @@ asmlinkage long sparc32_open(const char
if (!IS_ERR(tmp)) {
fd = get_unused_fd();
if (fd >= 0) {
- struct file * f = filp_open(tmp, flags, mode);
+ struct file * f = filp_open(tmp, flags | O_PUTNAME, mode);
error = PTR_ERR(f);
if (IS_ERR(f))
goto out_error;
fd_install(fd, f);
}
-out:
- putname(tmp);
}
return fd;
out_error:
put_unused_fd(fd);
- fd = error;
- goto out;
+ return error;
}
extern unsigned long do_mremap(unsigned long addr,
diff -urpNX dontdiff linux-2.5.38/fs/namei.c linux-2.5.38-willy/fs/namei.c
--- linux-2.5.38/fs/namei.c 2002-09-23 10:20:32.000000000 -0400
+++ linux-2.5.38-willy/fs/namei.c 2002-09-27 09:45:15.000000000 -0400
@@ -1244,6 +1244,8 @@ int open_namei(const char * pathname, in
*/
if (!(flag & O_CREAT)) {
error = path_lookup(pathname, lookup_flags(flag), nd);
+ if (flag & O_PUTNAME)
+ putname(pathname);
if (error)
return error;
dentry = nd->dentry;
@@ -1254,6 +1256,8 @@ int open_namei(const char * pathname, in
* Create - we need to know the parent.
*/
error = path_lookup(pathname, LOOKUP_PARENT, nd);
+ if (flag & O_PUTNAME)
+ putname(pathname);
if (error)
return error;
diff -urpNX dontdiff linux-2.5.38/fs/open.c linux-2.5.38-willy/fs/open.c
--- linux-2.5.38/fs/open.c 2002-07-27 14:09:31.000000000 -0400
+++ linux-2.5.38-willy/fs/open.c 2002-09-27 09:42:48.000000000 -0400
@@ -797,21 +797,18 @@ asmlinkage long sys_open(const char * fi
if (!IS_ERR(tmp)) {
fd = get_unused_fd();
if (fd >= 0) {
- struct file *f = filp_open(tmp, flags, mode);
+ struct file *f = filp_open(tmp, flags | O_PUTNAME, mode);
error = PTR_ERR(f);
if (IS_ERR(f))
goto out_error;
fd_install(fd, f);
}
-out:
- putname(tmp);
}
return fd;
out_error:
put_unused_fd(fd);
- fd = error;
- goto out;
+ return error;
}
#ifndef __alpha__
diff -urpNX dontdiff linux-2.5.38/include/linux/fcntl.h linux-2.5.38-willy/include/linux/fcntl.h
--- linux-2.5.38/include/linux/fcntl.h 2002-06-20 18:53:48.000000000 -0400
+++ linux-2.5.38-willy/include/linux/fcntl.h 2002-09-27 09:50:29.000000000 -0400
@@ -7,7 +7,7 @@
#define F_GETLEASE (F_LINUX_SPECIFIC_BASE+1)
/*
- * Request nofications on a directory.
+ * Request notifications on a directory.
* See below for events that may be notified.
*/
#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
@@ -45,6 +45,11 @@
#define IS_SETLK(cmd) (IS_SETLK32(cmd) || IS_SETLK64(cmd))
#define IS_SETLKW(cmd) (IS_SETLKW32(cmd) || IS_SETLKW64(cmd))
+/* Instructs open_namei() to get rid of the name ASAP */
+#ifndef O_PUTNAME
+#define O_PUTNAME 0x80000000
+#endif
+
#endif /* __KERNEL__ */
#endif