Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mq_open and permissions problems

Status
Not open for further replies.

lk5990

Programmer
Jul 2, 2001
7
US
I have a executable running in the background accepting requests into a queue it has created and sending responses back to the calling queue. If I call another executable to send the requests and wait for the response, the program works. If I have another user run the 2nd executable they cannot even open the queue created in the first exectuable. They get an error message that permission was denied when attempting to open the queue. Why does this only work if the same user is creating and accessing the queue. Please help...

Code from the executable which created the queue.

#define PMODE 0666
char * zipque = "/verifyaddr";
inmqd = mq_open(zipque, O_CREAT|O_RDWR, PMODE, &attr);
if (inmqd == (mqd_t)(-1)){
perror("Error opening zipqueue"); /*No problem here*/
exit(0);
}
printf("Waiting for messages\n");
/* Loop forever accepting requests into the queue */
do
{......}

Code from the executable which sends requests (permission problem here)

md = mq_open("/verifyaddr", O_RDWR);
if (md == (mqd_t)-1){
perror("Couldn't open the message queue");
mq_unlink(qname);/* from the queue created to accept only qname is based on process id number*/
mq_close(me);
exit(1);
}
(This only works if the same user who created the 'verifyaddr' queue is sending and receiving from it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top