mqueue: clean prepare_open() up
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
066cc813e9
commit
9b20d7fc52
29
ipc/mqueue.c
29
ipc/mqueue.c
@ -721,26 +721,19 @@ static int prepare_open(struct dentry *dentry, int oflag, int ro,
|
|||||||
MAY_READ | MAY_WRITE };
|
MAY_READ | MAY_WRITE };
|
||||||
int acc;
|
int acc;
|
||||||
|
|
||||||
if (oflag & O_CREAT) {
|
if (d_really_is_negative(dentry)) {
|
||||||
if (d_really_is_positive(dentry)) { /* entry already exists */
|
if (!(oflag & O_CREAT))
|
||||||
audit_inode(name, dentry, 0);
|
|
||||||
if (oflag & O_EXCL)
|
|
||||||
return -EEXIST;
|
|
||||||
} else {
|
|
||||||
if (ro)
|
|
||||||
return ro;
|
|
||||||
|
|
||||||
audit_inode_parent_hidden(name, dentry->d_parent);
|
|
||||||
return vfs_mkobj(dentry, mode & ~current_umask(),
|
|
||||||
mqueue_create_attr, attr);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (d_really_is_negative(dentry)) {
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
} else {
|
if (ro)
|
||||||
audit_inode(name, dentry, 0);
|
return ro;
|
||||||
}
|
audit_inode_parent_hidden(name, dentry->d_parent);
|
||||||
|
return vfs_mkobj(dentry, mode & ~current_umask(),
|
||||||
|
mqueue_create_attr, attr);
|
||||||
}
|
}
|
||||||
|
/* it already existed */
|
||||||
|
audit_inode(name, dentry, 0);
|
||||||
|
if ((oflag & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL))
|
||||||
|
return -EEXIST;
|
||||||
if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY))
|
if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
acc = oflag2acc[oflag & O_ACCMODE];
|
acc = oflag2acc[oflag & O_ACCMODE];
|
||||||
|
Loading…
Reference in New Issue
Block a user