lkml.org 
[lkml]   [2009]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] anonfd: Make file read-only if fops->write is not set
On Thu, Dec 17, 2009 at 09:46:11PM -0800, Roland Dreier wrote:
> diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
> index 2c99459..097f91f 100644
> --- a/fs/anon_inodes.c
> +++ b/fs/anon_inodes.c
> @@ -121,13 +121,13 @@ struct file *anon_inode_getfile(const char *name,
> d_instantiate(path.dentry, anon_inode_inode);
>
> error = -ENFILE;
> - file = alloc_file(&path, FMODE_READ | FMODE_WRITE, fops);
> + file = alloc_file(&path, FMODE_READ | (fops->write ? FMODE_WRITE : 0), fops);

Good grief, what for? We are already passing O_NDELAY in flags argument,
why not add O_RDWR/O_RDONLY to it? It's not as if we had that many
callers, after all...


\
 
 \ /
  Last update: 2009-12-18 07:13    [W:0.047 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site