diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-06-16 17:27:45 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-06-16 17:27:45 -0400 |
| commit | 65d04cbeb42318c66313346bb88999aee17f856f (patch) | |
| tree | cd779a01f3f78322392cce0039212d50a0bdddc3 /std/dynamic_library.zig | |
| parent | 48de57d8248d9203b44d28d7749b5d7c1a00deba (diff) | |
| download | zig-65d04cbeb42318c66313346bb88999aee17f856f.tar.gz zig-65d04cbeb42318c66313346bb88999aee17f856f.zip | |
std.DynLib: open the fd with CLOEXEC
Diffstat (limited to 'std/dynamic_library.zig')
| -rw-r--r-- | std/dynamic_library.zig | 7 |
1 files changed, 1 insertions, 6 deletions
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 @@ -12,13 +12,8 @@ pub const DynLib = struct { 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); |
