aboutsummaryrefslogtreecommitdiff
path: root/ipc/msgque.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/msgque.c')
-rw-r--r--ipc/msgque.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ipc/msgque.c b/ipc/msgque.c
index d664182..552f081 100644
--- a/ipc/msgque.c
+++ b/ipc/msgque.c
@@ -193,6 +193,11 @@ int main(int argc, char **argv)
int msg, pid, err;
struct msgque_data msgque;
+ if (getuid() != 0) {
+ printf("Please run the test as root - Exiting.\n");
+ exit(1);
+ }
+
msgque.key = ftok(argv[0], 822155650);
if (msgque.key == -1) {
printf("Can't make key\n");
@@ -201,6 +206,7 @@ int main(int argc, char **argv)
msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666);
if (msgque.msq_id == -1) {
+ err = -errno;
printf("Can't create queue\n");
goto err_out;
}