Ask a Question related to UNIX Programming, Design and Development.
-
Richard #1
SYS V messages: permission denied
I don't recall ever getting a permission denied on a message queue
that I created before. SuSE Linux 8.2, GNU gcc 3.3
This code calls msgget() then msgsnd(), basically cramming messages
into the queue up to the system limit.
If I compile and run it as my (non-root) self, I get a permission
denied on the msgsnd(). If I run it as root, all is well. I don't
get it, although it's probably something simple/stupid.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/msg.h>
extern int errno ;
#define MQKEY 4321
void
bail( char *, int ) ;
typedef struct msg_struct_tag
{
long type ;
int ndx ;
int len ;
} msg_struct ;
msg_struct msg ;
int
main(void)
{
int i, tot = 0, mqh ;
if ( (mqh = msgget( MQKEY, IPC_CREAT )) < 0 )
bail( "msqget()", errno ) ;
msg.type = 1 ;
msg.len = sizeof( msg ) ;
for ( i = 0 ; i < 30000 ; i++ )
{
msg.ndx = i ;
if ( msgsnd( mqh, (const void *)&msg, msg.len, IPC_NOWAIT ) < 0 )
bail( "msgsend()", errno ) ;
else
{
tot += msg.len ;
printf( "Msg %d: Total bytes sent: %d\n", i+1, tot ) ;
}
}
return 0 ;
}
void
bail( char * s, int e )
{
printf( "%s: %s\n", s, strerror( e ) ) ;
exit ( -1 ) ;
}
--
For email, put NOT SPAM in Subject or I'll probably miss it.
<><
Richard Guest
-
Permission Denied...
I'm not sure how many people have run into this problem, but it's one that is extremely annoying. When a user submits a file to me (or anyone else),... -
Permission denied
I'm running a intranet site on a NT 4.0 IIS 4 server. I have a page that uses CDONTS. I recently change this intranet application to run as an... -
ocx permission denied
I've updated an ocx (using VB6) that is currently being used in an asp 3.0 application. I created an internet package(using VB6) containing the... -
permission denied WHY?
Hi! I wrote this script and executed on my server, with php 4.1.2 <?php $fp = fopen('test.txt', 'w'); fwrite($fp, "Bla bla"); fclose($fp); ... -
Permission Denied (in FTP)
Hello, I'm having some slight issues. I have a script which creates a directory and then copies a blank file into it 4 times each with different... -
Richard #2
Re: SYS V messages: permission denied
[email]rochkind@basepath.com[/email] wrote...
<blush>. Thank you.> On Wed, 30 Jul 2003 05:35:15 GMT, Richard <rh310@hotmail.com> wrote:
>>> > I don't recall ever getting a permission denied on a message queue that I
> > created before. SuSE Linux 8.2, GNU gcc 3.3
> >
> [snip]
>
> Following based on a quick look... sorry if I missed something:
>
> Looks like the message queue is created with no permissions (you need to OR
> them in with IPC_CREAT). So, if the queue already exists, it can't be
> opened.
>
> Either remove the queue each time, or give yourself some permissions, such
> as at least 0600.
I owe you. Least I can do is order your book and read it. :)
--
For email, put NOT SPAM in Subject or I'll probably miss it.
<><
Richard Guest



Reply With Quote

