Skip to content

DynLib: fix a typo in DynLib.openZ #19494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/std/dynamic_library.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -466,4 +466,5 @@ test "dynamic_library" {
};

try testing.expectError(error.FileNotFound, DynLib.open(libname));
try testing.expectError(error.FileNotFound, DynLib.openZ(libname.ptr));
}