aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-12-01 17:57:02 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2018-01-05 11:54:36 -0500
commit9b20d7fc5250f50660c4dd4bea52e54e373b678d (patch)
tree2796acb4cee1a470f6448d19f89a4a01969d37a1 /ipc
parent066cc813e94a344ae4482af310d324739955c3b5 (diff)
mqueue: clean prepare_open() up
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index e8a872e9c808..ce498ff906bb 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -721,26 +721,19 @@ static int prepare_open(struct dentry *dentry, int oflag, int ro,
721 MAY_READ | MAY_WRITE }; 721 MAY_READ | MAY_WRITE };
722 int acc; 722 int acc;
723 723
724 if (oflag & O_CREAT) { 724 if (d_really_is_negative(dentry)) {
725 if (d_really_is_positive(dentry)) { /* entry already exists */ 725 if (!(oflag & O_CREAT))
726 audit_inode(name, dentry, 0);
727 if (oflag & O_EXCL)
728 return -EEXIST;
729 } else {
730 if (ro)
731 return ro;
732
733 audit_inode_parent_hidden(name, dentry->d_parent);
734 return vfs_mkobj(dentry, mode & ~current_umask(),
735 mqueue_create_attr, attr);
736 }
737 } else {
738 if (d_really_is_negative(dentry)) {
739 return -ENOENT; 726 return -ENOENT;
740 } else { 727 if (ro)
741 audit_inode(name, dentry, 0); 728 return ro;
742 } 729 audit_inode_parent_hidden(name, dentry->d_parent);
730 return vfs_mkobj(dentry, mode & ~current_umask(),
731 mqueue_create_attr, attr);
743 } 732 }
733 /* it already existed */
734 audit_inode(name, dentry, 0);
735 if ((oflag & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL))
736 return -EEXIST;
744 if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY)) 737 if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY))
745 return -EINVAL; 738 return -EINVAL;
746 acc = oflag2acc[oflag & O_ACCMODE]; 739 acc = oflag2acc[oflag & O_ACCMODE];