From: Chris Wright <chrisw@osdl.org>

SUSv3 doesn't seem to specify one way or the other.  I don't have the POSIX
specs, and the old docs I have suggest that mq_open() creates an object
which is to be closed upon exec.



Jakub said:

I think it is valid and required:
 http://www.opengroup.org/onlinepubs/007904975/functions/exec.html

    All open message queue descriptors in the calling process shall be
    closed, as described in mq_close()

I'll add a new test for this into glibc testsuite.


---

 25-akpm/ipc/mqueue.c |    1 +
 1 files changed, 1 insertion(+)

diff -puN ipc/mqueue.c~mq_open-and-close_on_exec ipc/mqueue.c
--- 25/ipc/mqueue.c~mq_open-and-close_on_exec	2004-04-14 18:37:51.252222736 -0700
+++ 25-akpm/ipc/mqueue.c	2004-04-14 18:37:51.255222280 -0700
@@ -646,6 +646,7 @@ asmlinkage long sys_mq_open(const char _
 		goto out_putfd;
 	}
 
+	set_close_on_exec(fd, 1);
 	fd_install(fd, filp);
 	goto out_upsem;
 

_