hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 325486f5f8f4b18eaa14914603224865eed4ada3
parent 375e360eeb6356a80bbf7f0ab06c36d1e8191d57
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed, 13 Apr 2022 15:42:38 +0200

os+freebsd: add init_cwd workaround

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mos/+freebsd/fs.ha | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/os/+freebsd/fs.ha b/os/+freebsd/fs.ha @@ -7,9 +7,16 @@ use path; use rt; use strings; -@init fn init() void = { +export fn init_cwd() void = { + // XXX: Workaround for https://todo.sr.ht/~sircmpwn/hare/616 static let cwd_fs = os_filesystem { ... }; - cwd = static_dirfdopen(rt::AT_FDCWD, &cwd_fs); + if (cwd_fs.dirfd == 0) { + cwd = static_dirfdopen(rt::AT_FDCWD, &cwd_fs); + }; +}; + +@init fn init() void = { + init_cwd(); }; // Returns the current working directory. The return value is statically