From 65d04cbeb42318c66313346bb88999aee17f856f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 16 Jun 2018 17:27:45 -0400 Subject: std.DynLib: open the fd with CLOEXEC --- std/dynamic_library.zig | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'std/dynamic_library.zig') diff --git a/std/dynamic_library.zig b/std/dynamic_library.zig index 87b58ec207..8fe5f7f818 100644 --- a/std/dynamic_library.zig +++ b/std/dynamic_library.zig @@ -11,14 +11,9 @@ pub const DynLib = struct { map_addr: usize, map_size: usize, - /// Trusts the file - pub fn findAndOpen(allocator: *mem.Allocator, name: []const u8) !DynLib { - return open(allocator, name); - } - /// Trusts the file pub fn open(allocator: *mem.Allocator, path: []const u8) !DynLib { - const fd = try std.os.posixOpen(allocator, path, 0, linux.O_RDONLY); + const fd = try std.os.posixOpen(allocator, path, 0, linux.O_RDONLY | linux.O_CLOEXEC); errdefer std.os.close(fd); const size = usize((try std.os.posixFStat(fd)).size); -- cgit v1.2.3