commit 2996bee1a65156f2714982a5f3d588aaaed0edc4
parent b4cabe39aba41f93be60d15a2503a105c4841ed4
Author: Drew DeVault <sir@cmpwn.com>
Date: Wed, 3 Feb 2021 08:12:22 -0500
os::fdstream: dup name str during initialization
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/os/+linux/fdstream.ha b/os/+linux/fdstream.ha
@@ -32,7 +32,7 @@ fn static_fdopen(
// a name will be generated based on the file descriptor number.
export fn fdopen(fd: int, name: str, mode: io::mode) *io::stream = {
let stream = alloc(*fd_stream, fd_stream { ... });
- static_fdopen(fd, name, mode, stream);
+ static_fdopen(fd, strings::dup(name), mode, stream);
stream.stream.closer = &fd_close;
return &stream.stream;
};