aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSashko <2179872-misanthrop@users.noreply.gitlab.com>2024-03-30 17:36:21 +0100
committerAndrew Kelley <andrew@ziglang.org>2024-07-01 19:44:20 -0400
commit8ef24461a0016062e0ca20d1a152dd82fac511ab (patch)
tree5c0a0ed6186395d6d3f56d615359d99f8294679d /lib
parentcb308ba3ac2d7e3735d1cb42ef085edb1e6db723 (diff)
downloadzig-8ef24461a0016062e0ca20d1a152dd82fac511ab.tar.gz
zig-8ef24461a0016062e0ca20d1a152dd82fac511ab.zip
DynLib: fix a typo in DynLib.openZ
Diffstat (limited to 'lib')
-rw-r--r--lib/std/dynamic_library.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/std/dynamic_library.zig b/lib/std/dynamic_library.zig
index f0e8ae0f11..a1db48b470 100644
--- a/lib/std/dynamic_library.zig
+++ b/lib/std/dynamic_library.zig
@@ -31,7 +31,7 @@ pub const DynLib = struct {
/// Trusts the file. Malicious file will be able to execute arbitrary code.
pub fn openZ(path_c: [*:0]const u8) Error!DynLib {
- return .{ .inner = try InnerType.open(path_c) };
+ return .{ .inner = try InnerType.openZ(path_c) };
}
/// Trusts the file.
@@ -376,7 +376,7 @@ pub const WindowsDynLib = struct {
/// WindowsDynLib specific
/// Opens dynamic library with specified library loading flags.
pub fn openExZ(path_c: [*:0]const u8, flags: windows.LoadLibraryFlags) Error!WindowsDynLib {
- const path_w = try windows.cStrToPrefixedFileW(null, path_c);
+ const path_w = windows.cStrToPrefixedFileW(null, path_c) catch return error.InvalidPath;
return openExW(path_w.span().ptr, flags);
}
@@ -466,4 +466,5 @@ test "dynamic_library" {
};
try testing.expectError(error.FileNotFound, DynLib.open(libname));
+ try testing.expectError(error.FileNotFound, DynLib.openZ(libname.ptr));
}