authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-04-14 01:24:18+10:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-13 13:26:13-04:00
logd29ed2a78567e26065e021d6dd2cbcb952b9d7d0
treeea45f0d69513f7e74faa74b2c1141a6871953fdc
parentb702964ae279156418f1110435103e30167af982

std: fix StreamSource to disallow writing to a const buffer


1 files changed, 1 insertions(+), 1 deletions(-)

lib/std/io/stream_source.zig+1-1
...@@ -39,7 +39,7 @@ pub const StreamSource = union(enum) {...@@ -39,7 +39,7 @@ pub const StreamSource = union(enum) {
39 pub fn write(self: *StreamSource, bytes: []const u8) WriteError!usize {39 pub fn write(self: *StreamSource, bytes: []const u8) WriteError!usize {
40 switch (self.*) {40 switch (self.*) {
41 .buffer => |*x| return x.write(bytes),41 .buffer => |*x| return x.write(bytes),
42 .const_buffer => |*x| return x.write(bytes),42 .const_buffer => return error.AccessDenied,
43 .file => |x| return x.write(bytes),43 .file => |x| return x.write(bytes),
44 }44 }
45 }45 }