fix bug in dladdr that prevented resolving addresses in the PLT
[oweals/musl.git] / src / stdio / __fopen_rb_ca.c
index 89ccbc374b513095f6cb6521d40f3128590ed6ef..9202c8ce5c1423b33bdfc571cd93d16db2d4af5b 100644 (file)
@@ -1,10 +1,12 @@
 #include "stdio_impl.h"
+#include <fcntl.h>
+#include <string.h>
 
 FILE *__fopen_rb_ca(const char *filename, FILE *f, unsigned char *buf, size_t len)
 {
        memset(f, 0, sizeof *f);
 
-       f->fd = syscall(SYS_open, filename, O_RDONLY|O_LARGEFILE, 0);
+       f->fd = syscall(SYS_open, filename, O_RDONLY|O_LARGEFILE|O_CLOEXEC, 0);
        if (f->fd < 0) return 0;
 
        f->flags = F_NOWR | F_PERM;