[Bug 245319] mq_open does not honor its mode argument

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Apr 3 15:56:13 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245319

            Bug ID: 245319
           Summary: mq_open does not honor its mode argument
           Product: Base System
           Version: 12.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: misc
          Assignee: bugs at FreeBSD.org
          Reporter: I.N10.2 at programmer.net

Here is the code:

void  openMsgQueue(void)
{
    mode_t           mode = S_IRUSR | S_IWUSR |
                            S_IRGRP | S_IWGRP |
                            S_IROTH | S_IWOTH;
    struct mq_attr   attributes;

    bzero(&attributes, sizeof(attributes));
    attributes.mq_maxmsg = 100;
    attributes.mq_msgsize = MSG_MAX_SIZE;
    mqid = mq_open(QUEUE_NAME, O_RDONLY | O_CREAT, mode, attributes);
    if ((mqd_t) -1 == mqid)
    {
        err(1, "mq_open");
    }
}

Obviously, MSG_MAX_SIZE and QUEUE_NAME are defined elsewhere.

After running this function for the first time, the QUEUE_NAME was created, but
the permissions on the queue were:
-rw-r--r--

Since I specified that every user should have "rw" access, but it didn't
happen, I had to use chmod so other users could send messages to this queue.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list