From dde5602fbe9619ad1caafbfdaad47b9605da1ffa Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 20 Jun 2013 13:31:26 +0100 Subject: Open the bmm device with O_CLOEXEC We don't want to pass the BMM file descriptor to child programs, so ensure that it is opened using the O_CLOEXEC flag to prevent that happening. --- bmm_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bmm_lib.c b/bmm_lib.c index d92ca39..1a4063c 100644 --- a/bmm_lib.c +++ b/bmm_lib.c @@ -36,7 +36,7 @@ int bmm_init() { /* attempt to open the BMM driver */ if(bmm_fd < 0) { - bmm_fd = open(BMM_DEVICE_FILE, O_RDWR); + bmm_fd = open(BMM_DEVICE_FILE, O_RDWR | O_CLOEXEC); pr_debug("BMM device fd: %d\n", bmm_fd); } -- cgit