Skip to content

Commit

Permalink
mqueue: clean prepare_open() up
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jan 5, 2018
1 parent 066cc81 commit 9b20d7f
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions ipc/mqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,26 +721,19 @@ static int prepare_open(struct dentry *dentry, int oflag, int ro,
MAY_READ | MAY_WRITE };
int acc;

if (oflag & O_CREAT) {
if (d_really_is_positive(dentry)) { /* entry already exists */
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)) {
if (d_really_is_negative(dentry)) {
if (!(oflag & O_CREAT))
return -ENOENT;
} else {
audit_inode(name, dentry, 0);
}
if (ro)
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))
return -EINVAL;
acc = oflag2acc[oflag & O_ACCMODE];
Expand Down

0 comments on commit 9b20d7f

Please sign in to comment.