Index: sys/kern/sysv_msg.c =================================================================== RCS file: /cvsroot/src/sys/kern/sysv_msg.c,v retrieving revision 1.64 diff -u -p -u -r1.64 sysv_msg.c --- sys/kern/sysv_msg.c 23 Jul 2013 07:03:16 -0000 1.64 +++ sys/kern/sysv_msg.c 23 Jul 2013 22:16:42 -0000 @@ -851,6 +851,7 @@ restart: goto unlock; } user_msgp += typesz; + msgsz -= typesz; /* * Validate the message type @@ -1164,6 +1167,7 @@ restart: goto unlock; } user_msgp += typesz; + msgsz -= typesz; /* * Return the segments to the user @@ -1200,7 +1205,7 @@ restart: msg_freehdr(msghdr); cv_broadcast(&msq->msq_cv); - *retval = msgsz; + *retval = msgsz + typesz; unlock: mutex_exit(&msgmutex);