From: Ilya Maximets <i.maxim...@samsung.com>

QEMU always sets this flag unconditionally. We need to
check if it's supported.

Signed-off-by: Ilya Maximets <i.maxim...@samsung.com>
Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com>
Message-Id: <20190311135850.6537-3-i.maxim...@samsung.com>
Signed-off-by: Eduardo Habkost <ehabk...@redhat.com>
---
 util/memfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/memfd.c b/util/memfd.c
index 8debd0d037..d74ce4d793 100644
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -188,7 +188,7 @@ bool qemu_memfd_alloc_check(void)
 bool qemu_memfd_check(unsigned int flags)
 {
 #ifdef CONFIG_LINUX
-    int mfd = memfd_create("test", flags);
+    int mfd = memfd_create("test", flags | MFD_CLOEXEC);
 
     if (mfd >= 0) {
         close(mfd);
-- 
2.18.0.rc1.1.g3f1ff2140


Reply via email to