summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-12-22 04:52:11 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-12-22 04:52:11 +0000
commit59e1c612a240cbd3e6e51cd0082ddf2353903b93 (patch)
tree8e806c752b4e0f443b562f9fcc6b048b179fbe51
parent1d5b8b61eae2446a2a084c07efff146a24514acf (diff)
Clear the high bit of ipc_perm.seq so msgget(3) never returns a
negative message queue id; Vladimir B.Grebenschikov
-rw-r--r--sys/kern/sysv_msg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c
index 33fdc915183..6126eabb83e 100644
--- a/sys/kern/sysv_msg.c
+++ b/sys/kern/sysv_msg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_msg.c,v 1.12 2002/03/14 01:27:05 millert Exp $ */
+/* $OpenBSD: sysv_msg.c,v 1.13 2002/12/22 04:52:10 millert Exp $ */
/* $NetBSD: sysv_msg.c,v 1.19 1996/02/09 19:00:18 christos Exp $ */
/*
@@ -361,7 +361,7 @@ sys_msgget(p, v, retval)
msqptr->msg_perm.gid = cred->cr_gid;
msqptr->msg_perm.mode = (msgflg & 0777);
/* Make sure that the returned msqid is unique */
- msqptr->msg_perm.seq++;
+ msqptr->msg_perm.seq = (msqptr->msg_perm.seq + 1) & 0x7fff;
msqptr->msg_first = NULL;
msqptr->msg_last = NULL;
msqptr->msg_cbytes = 0;