aboutsummaryrefslogtreecommitdiff
path: root/std/dynamic_library.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-16 17:27:45 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-06-16 17:27:45 -0400
commit65d04cbeb42318c66313346bb88999aee17f856f (patch)
treecd779a01f3f78322392cce0039212d50a0bdddc3 /std/dynamic_library.zig
parent48de57d8248d9203b44d28d7749b5d7c1a00deba (diff)
downloadzig-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.zig7
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);